3

When I create a "Products Ordered" report in Magento, configurable products show up as a single product, where the sales of all child products were summed up.

How can I modify this behaviour, so that - additionally - the child products are shown and their sold quantities?

The used version is Magento 1.6.2.

SebiF
  • 509
  • 5
  • 16
  • 1
    works for 1.9.3 as well. please note that this is very resource intensive if you have a lot of orders – Mike May 17 '17 at 16:39

1 Answers1

8

millejano from #magento-de helped me out and allowed me to post this answer:

Create a rewrite for or copy /app/code/core/Mage/Reports/Model/Resource/Product/Collection.php to local.
In addOrderedQty(), change the line

->where('parent_item_id IS NULL')

to

->where('e.type_id = ?', 'simple')

You're done. Instead of the summed up configurable product, you will now see the underlying simple products in every report and even on the dashboard.

Original post by millejano: https://gist.github.com/3149637/

SebiF
  • 509
  • 5
  • 16
  • Great elegant solution, why the hell is there n standard option for this!? – Chris Morris Jul 19 '13 at 11:56
  • 1
    I needed the same thing for Magento 2. The solution is very similar, but the field name and table alias have changed: ->where('order_items.product_type = ?', 'simple') – Geat Oct 22 '20 at 17:20