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!

2 Answers 2

4

Your layout path seems to be correct with this one,

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

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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