0

I want to make a copy of the default Sales Order grid in Magento 2 to my own module.

1 Answer 1

0

If you just want to display sales order grid in your custom path, put this code in layout.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">
    <referenceBlock name="page.title">
        <action method="setPageTitle">
            <argument name="title" xsi:type="string">Saved Orders</argument>
        </action>
    </referenceBlock>
    <body>
        <referenceContainer name="content">
            <uiComponent name="sales_order_grid"/>
        </referenceContainer>
    </body>
</page>

Note "sales_order_order" ui component. We are using the same original grid in Sales -> Order grid. I think this is what your requirement is. Only problem in this is that you can't modify the grid without effecting it to the original grid.

In long answer, you need to create a route in your module, and if possible add a menu item too. then create controller and layout. Hope you know all those things. If that is not the case, follow the below tutorial and replace view/adminhtml/layout/exampleadminnewpage_helloworld_index.xml file's content with above code. https://devdocs.magento.com/guides/v2.4/ext-best-practices/extension-coding/example-module-adminpage.html

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.