Skip to content

Products ordered report doesn't show simple (child) products of configurable products #9196

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
NMills12 opened this issue Apr 10, 2017 · 10 comments
Assignees
Labels
Fixed in 2.2.x The issue has been fixed in 2.2 release line Fixed in 2.3.x The issue has been fixed in 2.3 release line Issue: Format is not valid Gate 1 Failed. Automatic verification of issue format is failed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Release Line: 2.1

Comments

@NMills12
Copy link

When I run the "Products Ordered" report in Magento 2, configurable products show up as a single product, where the sales of all its child products were summed up. Is there a way to change this so that only the child (simple) products are shown in the report with their sold quantities?

We are currently using version 2.0.7 community edition.

Steps to reproduce

Run products sold report

I should see how many of each simple product were sold

Actual result

Sales do not show for simple products that are ordered under a configurable product. The report only gives a summed up total of all the configurable products falling under it (example: if I sell chocolate bunnies in milk, dark and ivory I don't see sales for each of those chocolate types; I only see a total for all chocolate bunnies sold).

@vinoth-dckap
Copy link

I am working on this issue

@NMills12
Copy link
Author

NMills12 commented May 3, 2017 via email

@vkranjith
Copy link
Contributor

I am working on it.

@NMills12
Copy link
Author

NMills12 commented Jun 12, 2017 via email

magento-team pushed a commit that referenced this issue Jul 18, 2017
…'t show simple (child) products of configurable products #9908

 - Merge Pull Request #9908 from vkranjith/magento2:develop
 - Merged commits:
   1. 148c5cd
   2. e5ab63d
   3. e0e3764
   4. 5fda163
   5. fe68f61
   6. b05ff2b
   7. 2ba9093
   8. 96ea851
   9. 45fc72e
   10. 78b5f28
magento-team pushed a commit that referenced this issue Jul 18, 2017
…'t show simple (child) products of configurable products #9908
magento-team pushed a commit that referenced this issue Jul 18, 2017
[EngCom] Public Pull Requests

 - MAGETWO-70817: remove redundant else and use strict check #10271
 - MAGETWO-70787: update phpserver to support versioned static urls #10250
 - MAGETWO-70764: Fix overwrite default value image/file with NULL #10253
 - MAGETWO-70761: Show values that are duplicate in attribute error msg #10213
 - MAGETWO-70758: Fix for #4530 $product->getRatingSummary() always returns null […] #10248
 - MAGETWO-70706: simplify product lists #2 #9019
 - MAGETWO-70669: Fix fatal errors with deleteOptionsAndSelections #7711
 - MAGETWO-70464: Fix shipping address can use for billing #10130
 - MAGETWO-69913: magento/magento2 #9196 - Products ordered report doesn't show simple (child) products of configurable products #9908
@magento-team magento-team added Release Line: 2.1 Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development develop labels Jul 31, 2017
@magento-team
Copy link
Contributor

Internal ticket to track issue progress: MAGETWO-69913

@NMills12
Copy link
Author

NMills12 commented Aug 1, 2017

Just to be clear, does the above status change to "Done" mean this report is now updated? If so, how can I begin using this updated version of the report? Thank you.

@magento-engcom-team magento-engcom-team added Release Line: 2.1 Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development develop Issue: Format is not valid Gate 1 Failed. Automatic verification of issue format is failed Fixed in 2.3.x The issue has been fixed in 2.3 release line labels Sep 11, 2017
@magento-engcom-team
Copy link
Contributor

@NMills12 thank you for your report.
The fix for this issue is already available in release 2.2.0

@magento-engcom-team magento-engcom-team added the Fixed in 2.2.x The issue has been fixed in 2.2 release line label Sep 20, 2017
magento-team pushed a commit that referenced this issue Oct 3, 2017
… report doesn't show simple (child) products of configurable products #9908 - for 2.2
magento-team pushed a commit that referenced this issue Oct 3, 2017
… report doesn't show simple (child) products of configurable products #9908 - for 2.2
@harout-itology
Copy link

The best solution is to create an extension for this functionality or just use mine

https://github.com/harout-itology/Simpleproductsreport

@robocrax
Copy link

robocrax commented May 7, 2020

Hi,

It appears this is still not resolved. I'm on version 2.3.4 and I'm only getting 1 child product (single entry) per configurable product rather than all child products (multiple entries)

@Jakub-Czech
Copy link

Jakub-Czech commented Jan 14, 2022

This issue is not solved, also on version 2.3.6.
Even if we can see from the ordered items report the SKU of the simple product it is actually wrong.
In Magento\Reports\Model\ResourceModel\Product\Sold\Collection::addOrderedQty in line 79 there is following where condition: order_items.parent_item_id IS NULL
order_items is actually sales_order_item table and there is problem.
In this table there are items that are assigned to orders that were placed.
If there was only one item ordered in the sales_order_item it will be saved correctly with:

  • correct product_sku
  • product_type=simple
  • however parent_item_id=null
    So the condition above for the 'sold reports' will work.

This works different when order has more items. In the sales_order_item table are being saved items of type simple, but also configurable, so there are two records for each ordered item:

  • CONFIGURABLE: product_type=configurable , parent_item_id=null , product_sku=<value of sku for the simple product>
  • SIMPLE: product_type=simple , parent_item_id=<item id of configurable item> , product_sku=<value of sku for the simple product>

SQL for the ordered items report is actually selecting order items of type configurable. When the order has more simple items of the same parent (configurable) it will select first configurable item (with wrong sku fo the simple product).
In example:
Ordered items: T-shirt (configurable), blue-t-shirt (simple), green-t-shirt (simple).
In sales_order_item will be:

  • blue-t-shirt
  • t-shirt (with sku of blue t-shirt)
  • green-t-shirt
  • t-shirt (with sku of green t-shirt)

In report grid and generated report's csv will be:

  • blue-t-shirt x2

So we cannot rely on such WHERE condition (order_items.parent_item_id IS NULL), because it will simply select configurable items which wasnt really ordered, because you cannot order configurable product.

For those who are still looking for solution:
I changed where condition from order_items.parent_item_id IS NULL to order_items.product_type='simple'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Fixed in 2.2.x The issue has been fixed in 2.2 release line Fixed in 2.3.x The issue has been fixed in 2.3 release line Issue: Format is not valid Gate 1 Failed. Automatic verification of issue format is failed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Release Line: 2.1
Projects
None yet
Development

No branches or pull requests

9 participants