Magento2: Products in Cart report

Created on 1 Mar 2017  路  11Comments  路  Source: magento/magento2

Preconditions

  1. Magento 2.1.3
  2. PHP 5.6

Steps to reproduce

  1. Create a product
  2. Add product to cart
  3. Delete product
  4. View Products in Cart report

Expected result

Report page should display with no errors

Actual result

Exception #0 (Exception): Notice: Undefined offset: 5 in /var/www/src/vendor/magento/module-reports/Model/ResourceModel/Quote/Item/Collection.php on line 222

Looks like the code needs to check the product still exists before trying to add data to the collection.

Cannot Reproduce Clear Description Format is valid bug report

All 11 comments

Created an extension to fix this until Magento 2 team fixes it.
https://github.com/Radosav/Radosav_ReportFix

@dannynimmo I cannot reproduce this issue as described. Please provide the detailed steps I must follow to reproduce this issue. In addition, identify the web server you are running, the versions of PHP and MySQL, and any other information needed to reproduce your issue

@smoskaluk I feel I was pretty clear in my issue report, but I will detail further:

  1. As a Magento admin, create a new product in the backend
  2. As a customer, add the product to the cart
  3. As the Magento admin, delete the product from the system
  4. As the Magento admin, view the "Products in Carts" report (Reports > Marketing > Products in Carts)

    1. Depending on how many products on the website, there may be pagination, in which case you should click through all pages

@dannynimmo thank you for your update.
Unfortunately we still can not reproduce this issue.
Please provide following information:

  1. Type of the product in the shopping cart
  2. If it was registered customer or guest user
  3. It's not clear how pagination on the report page can depend on total products amount (step 4i in your comment). Can you reproduce this issue when there is no pagination?
  4. Do you still have other shopping cats active at the moment of error?
  5. Can you reproduce this issue on ver. 2.1.7?
  6. Do you use any external extensions?
  7. Please provide information about your environment: OS, web-server, MySQL version (as I can see PHP version is 5.6)
  8. 6.

I had the same problem. The module which @Radosav writes works.

You can also flush the following table, if you are in development environment: DELETE FROM quote_item;

I am having the same issue.

I installed @Radosav fix, but still it didn't work. Please suggest.

@veloraven please try to reproduce it with configurable product in shopping cart.
Thanks.

@dannynimmo I had a similar bug in my magento installation. I had created some products, they were added to cart and then these products were deleted. Deleting the products did not delete them from quote_item table. I deleted all rows from this table that had an invalid product_id and that fixed the bug for me. The products were deleted from Magento 2.1.2. I have upgraded to magento 2.1.8 now and I did not need to use the module suggested by @Radosav

@dannynimmo, thank you for your report.
We were not able to reproduce this issue by following the steps you provided. If you'd like to update it, please reopen the issue.
We tested the issue on 2.1.9

To reproduce this issue on 2.2.0 you have to:

  1. Create configurable with simple assigned. IMPORTANT: Configurable products must not have price fulfilled (but this is default behaviour)
  2. Open configurable product on FO, choose size and add to the basket
  3. Try to open Reports -> Products in Cart

Thanks @shreyap26 Your solution worked for me! There were a couple of deleted products in my quote_item table.

Was this page helpful?
0 / 5 - 0 ratings