1

I have installed a magento 2 extension via composer. Using composer to install an extension places the file inside of the core vendor file.

File I want to edit:

vendor/extension-vendor/magento2-extention/view/frontend/templates/email/template.phtml

I have tried to place the above path inside of app/code wit hthe following path, but this did not seem to work.

app/code/extension-vendor/magento2-extension/view/frontend/templates/email/template.phtml

If I want to extend the extension that I just installed. How would I do this?

  • Let me know if you have any issue. – Prince Patel Jul 15 '17 at 7:30
  • 1
    Both answers are technically correct, but @PrincePatel had the answer that worked best for me. – Jcargs Jul 17 '17 at 13:09
0

You just need to copy template.phtml in your custom theme at

app/design/frontend/Vendor/yourtheme/Vendor_Module/templates/email/template.phtml

flush cache and try..!

0

Check the layout file of original extension which will contain block name and template attached to it something like

<block class="Vendorname\Module\Block\Test"
            name="vendorname.test"
            template="Vendorname_Module::test.phtml"
            after="-"></block>

To overwrite this test.phtml file, in your module's layout file add this

<?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="vendorname.test">
        <action method="setTemplate">
            <argument name="template" xsi:type="string">Mycustom_Test::overwritten.phtml</argument>
        </action>
    </referenceBlock>
</layout>

In your layout file reference the same block name which is used in original extension as per above example.

Add following code in your module's etc/module.xml file to load your layout after original layout file

<sequence>
        <module name="Vendorname_Module"/>
</sequence>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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