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?

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

3 Answers 3

1

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..!

1
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>
0

i have installed an extension which i have purchased + a theme also which is bought from somewhere and now i want to override it too but the problem is i am unbale to figure out where i need to place it in app/design directory. should i place this extension directory from the vendor folder to my theme dir i.e app/design/frontend/theme_vendor/theme/ or should i place it in app/design/frontend/vendor_extension/extension

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.