I'm using Magento 2.2.4 & want to override admin theme template file & the path of the file is here:-
vendor/temando/module-shipping-m2/view/adminhtml/templates/sales/order/view/info.phtml
Actually, I've to add an anchor link in this file.
Solution 1:- Working Solution without completely override:-
Step1.1:- Modified file:-
/home/gonaturalcanada/migration/vendor/temando/module-shipping-m2/view/adminhtml/layout/sales_order_view.xml
<?xml version="1.0"?>
<!--
/**
* Refer to LICENSE.txt distributed with the Temando Shipping module for notice of license
*/
-->
<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>
<referenceContainer name="order_tab_info">
<!-- Commented core code by me -->
<!-- <block class="Temando\Shipping\Block\Adminhtml\Sales\Order\View\Info" name="order_info" template="Temando_Shipping::sales/order/view/info.phtml"> -->
<!-- End of Commented core code by me -->
<!-- Added my @custom code -->
<block class="Temando\Shipping\Block\Adminhtml\Sales\Order\View\Info" name="order_info" template="Test_Clientform::sales/order/view/info.phtml">
<!-- End of the Added my @custom code -->
<container name="extra_customer_info"/>
</block>
</referenceContainer>
</body>
</page>
Step1.2:- Added custom CSS file to design custom link in my custom module:-
app/code/Test/Clientform/view/adminhtml/layout/sales_order_view.xml
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<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">
<update handle="sales_order_transactions_grid_block"/>
<head>
<css src="Test_Orderdform::css/css.css"/>
</head>
</page>
Step1.3:-Template file in my custom module:-
copied
vendor/temando/module-shipping-m2/view/adminhtml/templates/sales/order/view/info.phtml
content to
app/code/Test/Clientform/view/adminhtml/templates/sales/order/view/info.phtml
& added my custom link in this file.
After doing this I'm getting my expected result.
Please visit here to see:-
But this is not a standard way because I've directly modified in the file:-
vendor/temando/module-shipping-m2/view/adminhtml/layout/sales_order_view.xml
Solution 2:- Solution by completely override but getting a problem:-
In the solution2 only I need to override:-
vendor/temando/module-shipping-m2/view/adminhtml/layout/sales_order_view.xml
because i already modified phtml file in solution1.
Step2.1:-
app/code/Test/Clientform/view/adminhtml/layout/sales_order_view.xml
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<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">
<update handle="sales_order_transactions_grid_block"/>
<head>
<css src="Test_Orderdform::css/css.css"/>
</head>
<body>
<referenceBlock name="column_name">
<block class="Temando\Shipping\Block\Adminhtml\Sales\Order\View\Info" name="sales_order_view_custom" template="Test_Clientform::sales/order/view/info.phtml" />
</referenceBlock>
</body>
</page>
I'm getting the following result which is not expected one:-
You can see designs are improper/broken.
Note:- I think there can be some problem in:-
<referenceBlock name="column_name">
i replaced "column_name" with "order_info" but it doesn't work.
so please let me know what I need to add/modify so that I can resolve this problem.
Thanks in advance.