I'm following https://ranasohel.me/2015/10/02/how-to-overwrite-sales-view-order-phtml-file-in-magento2/
I would like to override magento\vendor\magento\module-shipping\view\adminhtml\templates\order\view\info.phtml
How to do this?
I'm following https://ranasohel.me/2015/10/02/how-to-overwrite-sales-view-order-phtml-file-in-magento2/
I would like to override magento\vendor\magento\module-shipping\view\adminhtml\templates\order\view\info.phtml
How to do this?
I've faced the same issue if i refrence to order_info block, you need to reference to order_shipping_view block instead
app/code/Vendor/Module/view/adminhtml/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_shipping_view">
<action method="setTemplate">
<argument name="template" xsi:type="string">Namespace_Module::order/view/info.phtml</argument>
</action>
</referenceBlock>
</body>
</page>
app/code/Namespace/Module/view/adminhtml/templates/order/view/info.phtml
<h1> Override Success </h1>
<h2> Put Your desire content here </h2>
flush magento cache, do setup:upgrade
One of the easiest way is that we will create a new backend admin: How to enable custom admin theme in Magento 2.
app/design/adminhtml/{Vendor}/{Theme}/Magento_Shipping/templates/order/view/info.phtml
The second way, set our custom template
app/code/{Vendor}/{Module}/view/adminhtml/layout/sales_order_view.xml
<referenceBlock name='order_info'>
<arguments>
<argument name='template' xsi:type='string'>Vendor_Module::order/view/info.phtml</argument>
</arguments>
</referenceBlock>
Load custom module layout after shipping
app/code/{Vendor}/{Module}/etc/module.xml
<sequence>
<module name="Magento_Sales"/>
</sequence>
sales_order_view.xml
is <?xml version="1.0"?> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="admin-2columns-left" 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">Custom_Module::order/view/info.phtml</argument> </action> </referenceBlock> </body> </page>
Where to put sequence
code?
module.xml
will be <?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="Custom_Module" setup_version="1.0.1"> <sequence> <module name="Magento_Shipping"/> </sequence> </module> </config>
I just ran into this same issue with version 2.3.2. I could not get the above solutions to work for some reason. Finally I just tried copying the full xml from vendor/magento/module-shipping/view/adminhtml/layout/sales_order_view.xml
to my own extension app/code/Vendor/Module/view/adminhtml/layout/sales_order_view.xml
You then just need to copy the template file Magento_Shipping::order/view/info.phtml
and move it to you custom extension and make the changes you need.