1

I have the below template override in a custom module, the file path is:

app/code/Vendor/Module/view/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="data">
            <action method="setTemplate">
                <argument name="template" xsi:type="string"> Vendor_Module::order/create/data.phtml</argument>
            </action>
        </referenceBlock>
    </body>
</page>

This override makes a few changes to the admin page for the creation of an order, when i go through the add order process it initially asks to select or add a customer. once this is done it loads the order page I'm overriding by AJAX, during which it loads the default one found at vendor/magento/module-sales/view/adminhtml/templates/order/create/data.phtml instead. When I refresh the page, ie with no AJAX being used to load it; it loads fine. I've tried different override methods; clearing caches and different modes (default, development, production).

I also manually installed this plugin https://mageside.com/custom-shipping-price-2.html which seems to have the same issue if that helps.

Where am I going wrong?

1

See extra Space on

<argument name="template" xsi:type="string"> Vendor_Module::order/create/data.phtml</argument>

extra space between xsi:type="string"> and Vendor_Module.

Remove this.

Also, there are two layout files, you need to define templates for data.phtml

  1. sales_order_create_index.xml
  2. sales_order_create_load_block_data.xml

Use below layout for changes the template instead of argument pattern,

<?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="data" template="Vendor_Module::order/create/data.phtml"/>
    </body>
</page>

Also, add make Magento_Sales as a sequence of Vendor_Module.

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
    <module name="Vendor_Module" >
        <sequence>
            <module name="Magento_Sales"/> <!-- Dependable extension-->
        </sequence>
    </module>
</config>

Note that after this changes you need to run setup upgrade as module sequence is changed.

Your Answer

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

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