How to add custom variables to new order E-mail in magento?

You can add custom variable data or something related to product's attribute in any transactional email. You also can write your custom code according to the current order id and display the required result. If you want to use new module, you can create hope for creating new module I don't need to describe the steps here.

open your layout file.xml then write below xml there

<block type="sales/order_email_items" name="anything" template="email/anyname.phtml"/>

In anyname.phtml file you can write <?php $_order = $this->getOrder(); ?> to get the order object.

Now go to order transactional email then write

{{layout handle="sales_email_order_anything" order=$order}}

Replace all anything/anyname to suitable text


  1. i found you have stopped posted blogs i was really enjoying your blogs and that was really helpful to every developer so just informing we all developers are waiting for your post

  2. thanks for posting nice blog very helpful for this code for my project Thanks You very much