4

I need to add some modification on the following file so that i'm trying to overwrite the file in local

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

to app/design/frontend/Vendor/theme/Magento_Sales/adminhtml/templates/order/view/info.phtml

also try app/design/frontend/Vendor/theme/Magento_Sales/adminhtml/templates/order/view/info.phtml app/design/frontend/Vendor/theme/Magento_Sales/templates/adminhtml/order/view/info.phtml

But it seems not working...!

6
  • Let me know if you have any issue. Commented Jul 6, 2017 at 5:05
  • @ Prince Patel Please look my full code its not working can you please check it
    – amith lal
    Commented Jul 6, 2017 at 5:15
  • Replace Vendor_Module to Pikbutton_Admin at sales_order_view.xml Commented Jul 6, 2017 at 5:20
  • @ Prince Patel its working thank you soo much
    – amith lal
    Commented Jul 6, 2017 at 5:29
  • Your Welcome :) Happy Coding......... Commented Jul 6, 2017 at 5:31

3 Answers 3

19

You Cannot Override Admin Files Directly In Your Theme. You Need Custom Module For Overriding Admin Files OR Use Existing Custom Module.

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

to app/code/Vendor/Module/view/adminhtml/templates/order/view/info.phtml

2) Create sales_order_view.xml at

app/code/Vendor/Module/view/adminhtml/layout/sales_order_view.xml

and add this code

<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">Vendor_Module::order/view/info.phtml</argument>
            </action>
        </referenceBlock>
    </body>
</page>

3) Depending on your cache settings you may have to clear cache: php bin/magento cache:clear

5
  • i have created the module with this code but still it loading from core folder
    – amith lal
    Commented Jul 6, 2017 at 5:07
  • I tested code in my custom module it's working fine. Please make sure your module is enabled. Commented Jul 6, 2017 at 5:16
  • @ Prince Patel did you check my updated code do i make any mistake there?
    – amith lal
    Commented Jul 6, 2017 at 5:19
  • can you answer for this? magento.stackexchange.com/questions/186141/…
    – amith lal
    Commented Jul 24, 2017 at 10:39
  • how to override Block files of admin? magento/module-sales/Block/Adminhtml/Order/Create/Form/Address.php. how to override this file Commented Oct 12, 2018 at 7:51
4

Create one module and in that module create one xml file in 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_info">
            <action method="setTemplate">
                <argument name="template" xsi:type="string">Vendor_Module::order/view/info.phtml</argument>
            </action>
    </referenceBlock>
</body>

1

Make sure that your info.phtml file is loaded from which xml file. possible 3 are sales_order_invoice_new.xml, sales_order_creditmemo_new.xml & sales_order_view.xml

In your custom module create an xml file like this,

app/code/Module/Namespace/view/frontend/layout/sales_order_view.xml

In that xml file, paste the below code

<?xml version="1.0"?>
<page layout="1column" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceContainer name="left">
            <referenceBlock name="order_info">
                <action method="setTemplate">
                    <argument name="template" xsi:type="string">Module_Namespace::order/view/info.phtml</argument>
                </action>
            </referenceBlock>
         </referenceContainer>
    </body>
</page>

Then create a template file in this path

app/code/Module/Namespace/view/frontend/template/order/view/info.phtml.

Then you can add your custom code in that file.

Your Answer

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

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