Magento 2 ordered product report
سؤال
Report -> Product -> Ordered
I want to add new column Brand (f_brand) in report grid.
I am unable to find any Grid.php
or something like this file.
Can anyone help me on this? Which file I need to override and how can I add new column in this grid?
المحلول
It looks like the columns of that report are created in the layout file reports_report_product_sold_grid.xml. You would need to add a file with this name in your own module (e.g. Company/ModuleName/view/adminhtml/layout/reports_report_product_sold_grid.xml
) and add a new column block. Something like this
<block class="Magento\Backend\Block\Widget\Grid\Column" name="adminhtml.report.grid.columnSet.sku" as="sku">
<arguments>
<argument name="header" xsi:type="string" translate="true">SKU</argument>
<argument name="type" xsi:type="string">text</argument>
<argument name="index" xsi:type="string">order_items_sku</argument>
<argument name="id" xsi:type="string">sku</argument>
<argument name="column_css_class" xsi:type="string">col-sku</argument>
<argument name="header_css_class" xsi:type="string">col-sku</argument>
</arguments>
</block>
If you need custom functionality you could create a new Block that extends Magento\Backend\Block\Widget\Grid\Column
.
لا تنتمي إلى magento.stackexchange