How to override Adminhtml template files in Magento 2.3? In a proper way.
File to override:
vendor/magento/module-sales/view/adminhtml/templates/order/totals.phtml
Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It only takes a minute to sign up.
Sign up to join this communityHow to override Adminhtml template files in Magento 2.3? In a proper way.
File to override:
vendor/magento/module-sales/view/adminhtml/templates/order/totals.phtml
For overriding vendor/magento/module-sales/view/adminhtml/templates/order/totals.phtml
file you need to create a module.
Create sales_order_view.xml at
app/code/Your_VendorName/Your_ModuleName/view/adminhtml/layout/sales_order_view.xml
<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_totals">
<action method="setTemplate">
<argument name="template" xsi:type="string">Vendor_Module::order/totals.phtml</argument>
</action>
</referenceBlock>
</body>
</page>
Then Copy totals.phtml file from
vendor/magento/module-sales/view/adminhtml/templates/order/totals.phtml
To
app/code/Your_Vendor/Your_Module/view/adminhtml/templates/order/totals.phtml
Hope it helps!!!
First Step:
Path of the XML OSCP/ModuleName/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="column_name">
<action method="setTemplate">
<argument name="template" translate="true" xsi:type="string">OSCP_ModuleName::order/items/column/name.phtml</argument>
</action>
</referenceBlock>
</body>
</page>
Then copy the original file to
OSCP/ModuleName/view/adminhtml/templates/order/items/column/name.phtml
This is the Basic Pattern in Magento 2.3