Magento – Custom email layout handle for custom module

emailmagento-1.9PHP

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

Best Answer

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"}}
Related Topic