AnswerBun.com

Custom email layout handle for custom module

Magento Asked by Karan Adhikari on December 11, 2020

I have created a custom module, In which I am sending email to customer. email is working fine but I have created a layout handle in layout/test.xml

<?xml version="1.0"?>
<layout version="0.1.0">
    <my_name_is_hello>
        <block type="core/template" name="hello"  template="test/sales/items.phtml"></block>
    </my_name_is_hello>
</layout>

This is my content in test/sales/items.phtml

<h1>Hello</h1>

Now I have called layout handle in my email template file hello.phtml using both method but file is not getting called.

{{layout handle="my_name_is_hello"}}
{{block type='core/template' area='frontend' template='test/sales/items.phtml'}}

Please can anybody suggest me if I am doing something wrong or any solution

2 Answers

in your config.xml add this :

<global>
    ...
     <template>
         <email>
             <yourRooter_email_email_template translate="label" module="your module">
                 <label>custom email</label>
                 <file>custom_email.html</file>
                 <type>text</type>
             </yourRooter_email_email_template>
         </email>
     </template>
    ...
</global>

Then go to : app/locale/language_ISO/template/email/custom_email.html then add your block:

{{block type='core/template' area='frontend' template='test/sales/items.phtml'}}

Answered by PЯINCƏ on December 11, 2020

First add the layout of the block in sales.xml in layout section file.

<my_name_is_hello>
    <block type="core/template" name="hello"  template="test/sales/items.phtml"></block>
</my_name_is_hello>

Than after use the below line in the email template

 {{layout handle="my_name_is_hello"}}

Answered by Sumil sanghavi on December 11, 2020

Add your own answers!

Related Questions

Admin grid save & continue edit button – ui components

1  Asked on January 6, 2022 by rihards-repels

 

Change Magento 2 website based on IP

1  Asked on January 6, 2022

         

Magento 2 : Problem Adding Validation Form With Mixin

2  Asked on January 4, 2022 by juris-toms-liepi

   

magento 2.3.4 installation issue in localhost

1  Asked on January 2, 2022 by ggc

 

Disable products per store

2  Asked on December 30, 2021

       

Catalog Search reindex not completing

2  Asked on December 30, 2021 by stuart-hoff

   

Moving content of custom header Magento 2

1  Asked on December 30, 2021 by aissa-mahdi

     

Ask a Question

Get help from others!

© 2022 AnswerBun.com. All rights reserved. Sites we Love: PCI Database, MenuIva, UKBizDB, Menu Kuliner, Sharing RPP