I am overriding the Adminhtml Sales Order Create Items Grid template by using a layout in my custom module:
`views/adminhtml/layout/sales_order_create_index.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='items_grid>
<action method='setTemplate'>
<argument name='template' xsi:type='string'>Vendor_Module:rder/create/items/grid.phtml</argument>
</action>
</referenceBlock>
</body>
</page>
The problem I am facing is that when the page is loaded via AJAX:
1. Click "Create New Order"
2. Click on a customer
3. Page loads via AJAX and shows the grid.
The grid template that loads is the base grid template (`Magento_Sales/view/templates/order/create/items/grid.phtml`). If I refresh the page or enter the page directly, it loads the overridden template.
My question is: Where does this template get loaded first and how do I prevent it from loading, or how do I force my template to load every time.
I've posted this question to Stackoverflow too.http://magento.stackexchange.com/questions/167183/magento-2-adminhtml-grid-template
You have to override this handle too
sales_order_create_load_block_items.xml
for ajax call set template here too
Thank you for your reply. That did not work. I see that other Magento modules also override this layout and those seem to work. Perhaps I have a formatting issue?
My file: `/view/adminhtml/layout/sales_order_create_load_block_items.xml`
<?xml version="1.0"?> <!-- /** * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ --> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> <body> <referenceBlock name="items_grid"> <action method='setTemplate'> <argument name='template' xsi:type='string'>Vendor_Module::order/create/items/grid.phtml</argument> </action> </referenceBlock> </body> </page>