1

There are so many post discussing how to add column to sales order grid, but no one discussed about how to add a column to 'Order Total Report' grid (REPORTS > Customers > Order Total) and display custom customer data to new column in magento2.

Can someone tell me how to do that?

1 Answer 1

0

Try following way to add customer email to that grid:

app/code/SR/MagentoStackExchange/view/adminhtml/layout/reports_report_customer_totals_grid.xml


<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceBlock name="adminhtml.report.grid.columnSet">
            <block class="Magento\Backend\Block\Widget\Grid\Column" name="adminhtml.report.grid.columnSet.customer_email" as="email">
                <arguments>
                    <argument name="header" xsi:type="string" translate="true">Email</argument>
                    <argument name="sortable" xsi:type="string">0</argument>
                    <argument name="type" xsi:type="string">text</argument>
                    <argument name="index" xsi:type="string">customer_email</argument>
                    <argument name="id" xsi:type="string">customer_email</argument>
                    <argument name="column_css_class" xsi:type="string">col-name</argument>
                    <argument name="header_css_class" xsi:type="string">col-name</argument>
                </arguments>
            </block>
        </referenceBlock>
    </body>
</page>
2
  • how to display custom customer attribute value to newly added column? It's showing new column 'Affiliate ID' but not displaying value of custom attribute.
    – Prince FB
    Commented Feb 14, 2019 at 6:48
  • What do you mean by customer attribute? Check sales_order table column.
    – Sohel Rana
    Commented Feb 14, 2019 at 6:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.