Can anyone help how to override
vendor/magento/module-sales/view/adminhtml/templates/items/column/name.phtml file.
Can anyone help how to override
vendor/magento/module-sales/view/adminhtml/templates/items/column/name.phtml file.
At Magento2, from 7 layout items/column/name.phtml called
sales_order_creditmemo_new.xml
sales_order_creditmemo_updateqty.xml
That you need to identify for which page, you want rewrite name.phtml.
So, you will found out respective layout file and have to create that layout file on your custom module as mention by Michell process.
Suppose, you want to changes at invoice create page. Then have to create
1.app/code/Company/Module/view/adminhtml/layout/sales_order_invoice_new.xml
Code
<?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" template="Company_Module::orders/items/column/name.phtml"/>
</body>
</page>
This is very simple, follow my guide below :
Step 1 : create file :
app/code/Company/Module/view/adminhtml/layout/sales_order_view.xml
With content :
<?xml version="1.0"?>
<!--
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<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" xsi:type="string">Company_Module::orders/items/column/name.phtml</argument>
</action>
</referenceBlock>
</body>
</page>
Step 2 : create phtml file :
app/code/Company/Module/view/adminhtml/templates/orders/items/column/name.phtml
Then put your code here
You just need to make app/design/adminhtml/templates/items/column/name.phtml(write your custom code here)
then do setup upgrade and setup static-content deploy
php bin/magento s:up
php bin/magento s:s:d
override templates(.phtml) using custom theme
if you want to override vendor\magento\module-sales\view\adminhtml\templates\items\name.phtml first you need to create your custom theme, please refer this link for how to create a custom theme.
after that create phtml file in your custom theme to override the default one
app/design/frontend/vendor-name/theme-name/Magento_Catalog/templates/product/some.phtml
finally, clear the cache of Magento as well as the browser, then check your page, new phtml file only reflected.
in this way you can override templates
Best of Luck!
magento\app\design\adminhtml\YourVendor\YourThemeName\Magento_Backend\view\adminhtml\templates\product\some.phtml
– Sanjay Vadadoriya Sep 14 '18 at 07:39admin template, how do you want him to put it onfrontend as you response ?
– PЯINCƎ
Sep 14 '18 at 09:11
I figured it how to achieve. I just created a theme specifically for backend and from there I extend the module.