How to override items.phtml in module ? (Magento 2)
-
15-04-2021 - |
Domanda
I am trying to override module-sales/view/frontend/templates/email/creditmemo/items.phtml file but no changes appearing.
Is their any way i can override it in my module ?
Thankyou
Soluzione
Try:-
create a sales_email_order_creditmemo_items.xml
path:-
app/code/Vendor/Module/view/frontend/layout/sales_email_order_creditmemo_items.xml
<?xml version="1.0"?>
<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/layout_generic.xsd">
<referenceBlock name="items">
<action method="setTemplate">
<argument name="template" xsi:type="string">Vendor_Module::email/creditmemo/items.phtml</argument>
</action>
</referenceBlock>
</layout>
Altri suggerimenti
Please go to your theme and create folder Magento_Sales/templates/email/creditmemo
then download items.phtml
file
from /vendor/magento/module-sales/view/frontend/templates/email/creditmemo/
then paste here Magento_Sales/templates/email/creditmemo
your theme.
EDIT IF you want to override the template in the custom module, create a new layout file at below location :
<Vendor>_<Module>/view/frontend/layout/sales_email_order_creditmemo_items.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="items">
<arguments>
<argument name="template" xsi:type="string">Vendor_Module::items.phtml</argument>
</arguments>
</referenceBlock>
</body>
</page>
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a magento.stackexchange