Magento 2 : Custom template file is loading after refreshing the page only?
-
18-02-2021 - |
题
Here is my code for overriding vendor module template. when the page corresponding to this layout loads, it is fetching template file from vendor.after the refresh it is fetching from my custom module.Please help.
<referenceBlock name="items">
<action method="setTemplate">
<argument name="template" translate="true" xsi:type="string">My_Sales::order/create/items.phtml</argument>
</action>
</referenceBlock>
解决方案
Below layouts are to be overrided.
- sales_order_create_index.xml
- sales_order_create_load_block_items.xml
- sales_order_create_load_block_data.xml
其他提示
You should put this in module.xml
<?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="My_Sales" setup_version="0.0.1">
<sequence>
<module name="Magento_Checkout" />
</sequence>
</module>
</config>
Its depends which module you trying rewrite file