Magento – Different new order emails based on customer group

customer-groupemail-templatesmagento-1.8

I want to customise the new order email based upon the customer group. Ideally it would be great to have separate email templates for each group.

I have found the following plugin http://goo.gl/1JOsHR however wanted to know if this is the best way to go about this before I brought it or if there is a better extension or method out there

Best Answer

To send different order conformation email depending on specific criteria you would either have to :

  1. Rewrite sendNewOrderEmail() in Mage_Sales_Model_Order and add logic to check the template

  2. Disable magento "order confirmation email" in system config, then create a custom module to send your email by coping logic from sendNewOrderEmail() using event/observer

  3. For simple text changes, you could use template logic {{if order.customer_group_id}} or {{depend order.customer_group_id}} but they seem to only evaluate true/false condition, therefore for more advance logic you could include a block

{{block type='core/template' area='frontend' template='sales/custom_logic.phtml' order=$order}}

In custom_logic.phtml

<?php
  $order = $this->getOrder()

  if($order->getCustomerGroupId() == 1){
     ///do
   ....

See Magento Email Template If Statements