Customizing the 'New Order Confirmation Email' template in Magento may be a havoc for the first time if you do not know the write way. But it is as easy as anything. Recently I needed to customize the item information in the 'New Order Confirmation Email'. I googled a number of links but found nothing useful. Then I decided to find my own way, and after 2 hours of hard work I found a simple way. Here are the steps to customize the email template:
1. In the Magento Admin panel go to 'System > Transactional Emails' and click on 'Add New Template'.
2. In the 'Load default template' container select 'New Order' in the 'Template' dropdown. Alse select our desired 'Locale'.
3. Click on 'Load Template'. It will load the Default email template to edit for you. Now you can edit the 'Template Subject' and 'Template Content' to suit your needs. See the following screenshot:
Here we want to edit the item information in the order email. The email template calls a layout file as:
Replace
Save the template.
4. Now create orderemail.phtml in the template directory of your custom module.
Full file path: app\design\frontend\default\default\template\<module_name>\orderemail.phtml
In this template file we have $order available to user. You can access the order id from $order variable as:
5. Now in Magento Admin panel go to 'System > Configuration > Sales Emails'. In the 'Order' tab select your newly created template in the 'New Order Confirmation Template' dropdown. Save the options.
And you are ready to send the customized email template!!!
1. In the Magento Admin panel go to 'System > Transactional Emails' and click on 'Add New Template'.
2. In the 'Load default template' container select 'New Order' in the 'Template' dropdown. Alse select our desired 'Locale'.
3. Click on 'Load Template'. It will load the Default email template to edit for you. Now you can edit the 'Template Subject' and 'Template Content' to suit your needs. See the following screenshot:
Here we want to edit the item information in the order email. The email template calls a layout file as:
{{layout handle="sales_email_order_items" order=$order}}
for the item information. So we will replace this line so that we can call our own custom template in place of the default layout file.Replace
{{layout handle="sales_email_order_items" order=$order}}with {{block type='core/template' area='frontend' template='<module_name>/orderemail.phtml' order=$order}}where template='<module_name>/orderemail.phtml' tells Magento the path of template file to be called. We have also passed order variable in the call as order=$order, so the $order variable is available to us in the template file that holds the current order information.Save the template.
4. Now create orderemail.phtml in the template directory of your custom module.
Full file path: app\design\frontend\default\default\template\<module_name>\orderemail.phtml
In this template file we have $order available to user. You can access the order id from $order variable as:
$order_id = $this->getData('order')->getRealOrderId();
Now you can access all order information here and write your custom HTML format to be shown in the email. You can change the way the item information is shown or add more item information in the email template. 5. Now in Magento Admin panel go to 'System > Configuration > Sales Emails'. In the 'Order' tab select your newly created template in the 'New Order Confirmation Template' dropdown. Save the options.
And you are ready to send the customized email template!!!


Nice post brother !!!
ReplyDeleteKeep up the good work !!!
Nice post!
ReplyDeleteHowever I cannot make it to work.
Strange thing - the block is loaded into template (I can see it in email when debugger is on).
But no content is loading from this block.
Do you know what issue this may be?
This is so strange, but suddenly i am having this problem too. i know this is old, but can you tell me how you fixed it?
DeleteThis is so strange, but suddenly i am having this problem too. i know this is old, but can you tell me how you fixed it?
Delete@Igor, Blogger
DeleteYour issue seems to be a coding glitch. I dont think anyone can guess it without diving into the code. Otherwise it works absolutely fine.
Thanks.
Is it possible to add custom product attributes to the transactional emails?
ReplyDeleteIt is not necessary to set up a new module. Simply copy
ReplyDelete/app/design/frontend/base/default/template/email/order/items.phtml
and
/app/design/frontend/base/default/template/email/order/items/order/default.phtml
to your custom theme folder.
Thanx man its working fine for me.. thanx again..
ReplyDeletecheck this, this may work
ReplyDeletehttp://blog.free-extension.com/2011/04/07/adding-attribute-to-the-new-order-notification-email-in-magento/
You save my lot of time and found great knowledge which is helpful to many projects.
ReplyDeleteThanks for sharing such a great knowledge with us.
everything was ok since the site went live, suddenly there are some order confirmation email are not sending, 4/5 out of 10 order the confirmation email not sending, struggling to solve this issue, can any one help me out please
ReplyDeleteThanks
@Fozla Alahi Bhuyain, I dont think anyone can see to this issue without having access to the actual code.
DeleteHi,
ReplyDeleteHow can we send automatically an email to the suppliers whose order has been placed by the customer. For example: suppose i have three suppliers A, B and C.
A supplier has one product. B has also one product. But C has more than 5 products. Now suppose as a client i give an order for the products from Supplier A (one item) and C (3 items). Now what i want that suppliers will receive mails (Supplier A will receive one mail and Supplier C will receive 3 mails for 3 different products) for theirs products automatically. I will be thankful to you if you can help me out.
ad asd asd
ReplyDeleteala lakhota upload kar ni
ReplyDeleteThank you for your post!
ReplyDeleteThis one seems much easier: http://shamimcse05.wordpress.com/2011/04/07/adding-attribute-to-the-new-order-notification-email-in-magento/
Nice post, I spent a lot of time looking for where to save a new email template. If you're looking for a way to create a better looking template for new order emails, we built a free template creator specifically for Magento. You can give it a try at http://www.klaviyo.com/magento-email-templates.
ReplyDeleteNice post, I spent a lot of time looking for where to save a new email template. If you're looking for a way to create a better looking template for new order emails, we built a free template creator specifically for Magento. You can give it a try at http://www.klaviyo.com/magento-email-templates.
ReplyDeleteWe spent a bunch of time figuring out these instructions, so nice to have them in one place.
ReplyDeleteIf anyone's looking for an easy/free way to create a better looking new order template, we built a template creator you case use: http://www.klaviyo.com/magento-email-templates.