Magento – How tonclude Customized phtml file in email template

email-templatesmagento-1.8template

I am trying to send coupon code with email on new account registration. For that I created email template system > transactional emails.

Here in this email template I have included coupon.phtml file which is located at app/design/frontend/theme/default/template/email/coupon.phtml using below code.

{{block type="core/template" name="email_coupon" template="email/coupon.phtml"}}

But this is not working. I am not getting any html which I have added in coupon.html. Please guide where I have mistaken.

Best Answer

For this case you need to create a handler and this handler will render the you phtml( at local.xml at app/design/frontend/YOUR_PAackage/YOUR_template/layout) on html template

<?xml version="1.0"?>
<layout version="0.1.0">
    <amit_customer_addhan>
        <block type="core/template" name="email_coupon" template="email/coupon.phtml" />
    </amit_customer_addhan>
</layout>

then on email html template call handler

   {{layout handle="amit_customer_addhan" }}

OR: Without call of handler:

call a block file without layout handler and ans parameter for

 {{block type='core/template' area='frontend' template='email/coupon.phtml' }}

\ see more at Display line in transactional e-mail if payment method is

Related Topic