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

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP