Skip to content

Commit 5c0efdd

Browse files
author
Oleksii Korshenko
committed
MAGETWO-69913: magento/magento2 #9196 - Products ordered report doesn'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
2 parents ce5dbd5 + 78b5f28 commit 5c0efdd

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

app/code/Magento/Reports/Model/ResourceModel/Product/Sold/Collection.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,17 +64,19 @@ public function addOrderedQty($from = '', $to = '')
6464

6565
$this->getSelect()->reset()->from(
6666
['order_items' => $this->getTable('sales_order_item')],
67-
['ordered_qty' => 'SUM(order_items.qty_ordered)', 'order_items_name' => 'order_items.name']
67+
[
68+
'ordered_qty' => 'order_items.qty_ordered',
69+
'order_items_name' => 'order_items.name',
70+
'order_items_sku' => 'order_items.sku'
71+
]
6872
)->joinInner(
6973
['order' => $this->getTable('sales_order')],
7074
implode(' AND ', $orderJoinCondition),
7175
[]
7276
)->where(
73-
'parent_item_id IS NULL'
74-
)->group(
75-
'order_items.product_id'
77+
'order_items.parent_item_id IS NULL'
7678
)->having(
77-
'SUM(order_items.qty_ordered) > ?',
79+
'order_items.qty_ordered > ?',
7880
0
7981
);
8082
return $this;

app/code/Magento/Reports/view/adminhtml/layout/reports_report_product_sold_grid.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,16 @@
4141
<argument name="header_css_class" xsi:type="string">col-product</argument>
4242
</arguments>
4343
</block>
44+
<block class="Magento\Backend\Block\Widget\Grid\Column" as="sku">
45+
<arguments>
46+
<argument name="header" xsi:type="string" translate="true">SKU</argument>
47+
<argument name="type" xsi:type="string">text</argument>
48+
<argument name="index" xsi:type="string">order_items_sku</argument>
49+
<argument name="id" xsi:type="string">sku</argument>
50+
<argument name="column_css_class" xsi:type="string">col-sku</argument>
51+
<argument name="header_css_class" xsi:type="string">col-sku</argument>
52+
</arguments>
53+
</block>
4454
<block class="Magento\Backend\Block\Widget\Grid\Column" as="ordered_qty">
4555
<arguments>
4656
<argument name="header" xsi:type="string" translate="true">Ordered Quantity</argument>

0 commit comments

Comments
 (0)