Magento 2 – How to Override info.phtml from Module Sales

magento2overridesphtml

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!

Best Answer

Your layout path seems to be correct with this one,

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