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:
{{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 availableto 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 $ordervariable 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 yournewly created template in the 'New Order Confirmation Template' dropdown. Save the options.


