I want to join my order table with the Magento order table to display data on my custom grid. The correct way to add fields to a DataProvider is by using addFieldStrategies and addFilterStrategies via di.xml.

  • di.xml
        <type name="MyVendor\MyModule\Ui\DataProvider\Order\DataProvider">
                    <argument name="addFieldStrategies" xsi:type="array">
                        <item name="reason" xsi:type="object">MyVendor\MyModule\Ui\DataProvider\Order\Grid\Strategies\AddReasonFieldToCollection</item>
                    <argument name="addFilterStrategies" xsi:type="array">
                        <item name="reason" xsi:type="object">MyVendor\MyModule\Ui\DataProvider\Order\Grid\Strategies\AddReasonFilterToCollection</item>

I can add only one field via this method, though I want to join 4 field as in

  • Dataprovider.php
            ['sales' => $this->collection->getTable('sales_order_grid')],
            'main_table.magento_order_id = sales.entity_id',
                'sales.status as magento_status'

What is the correct way to move this multi-field join to implement via addFieldStrategies and addFilterStrategies via di.xml?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.