1

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>
Prathap Gunasekaran
3,2891 gold badge17 silver badges39 bronze badges
asked Feb 13, 2019 at 11:49

2 Answers 2

1

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
answered Feb 19, 2019 at 13:50
2
  • Hi, did you find anything to resolve this, im facing the same issue. Magento version: 2.3.1 Commented Sep 9, 2019 at 4:34
  • i added respective code to all the above xml files and finally issue resolved Commented Sep 18, 2019 at 16:05
0

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

answered Feb 13, 2019 at 11:52
9
  • I have already added Magento_Sales, dependent module in module.xml. Issue is when the page loads and displays,the changes done in custom template file is not getting reflected. after refreshing the same page, the changes are reflecting. Commented Feb 13, 2019 at 12:01
  • maybe first time it was cache? Commented Feb 13, 2019 at 12:07
  • i tried enabling template hints and checked.on first load,it shows vendor folder template file.then after refresh it showed custom module template. Commented Feb 13, 2019 at 12:08
  • This happens alternatively on each refresh Commented Feb 13, 2019 at 12:14
  • what is the magento version? Commented Feb 13, 2019 at 12:18

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.