1

I have a custom module and I want to override a .phtml file.

This is what I want to override:

magento/vendor/magento/module-sales/view/adminhtml/templates/order/view/info.phtml

My 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="UV_Adressen" setup_version="0.0.1">
 <sequence>
 <module name="Magento_Sales"/>
 </sequence>
 </module>
</config>

Here I created the file in my module:

UV/Adressen/view/adminhtml/templates/order/view/info.phtml

I also created a layout-file:

UV/Adressen/view/adminhtml/templates/order/layout/sales_order_view.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="order_info">
 <action method="setTemplate">
 <argument name="template" xsi:type="string">UV_Adressen::order/view/info.phtml</argument>
 </action>
 </referenceBlock>
 </body>
</page>

After I executed

setup:upgrade and setup:di:compile

it still loads the core template file.

Thanks in Advance!

asked Apr 10, 2018 at 8:47

2 Answers 2

4

Your layout path seems to be correct with this one,

UV/Adressen/view/adminhtml/layout/sales_order_view.xml

answered Apr 10, 2018 at 9:06
0

After a lot of trial and error I came up with the following solution

https://magento.stackexchange.com/a/310741/70343

It requires a lot less content to be overridden and therefore is safer

answered Apr 18, 2020 at 22:11

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.