2

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

2
  • What type of customization do you want to do, is this just simple text changes or more complex design changes? Commented Sep 11, 2014 at 15:56
  • For 2 of the groups simple text changes but for another 2 I want a complete design change
    – Goose84
    Commented Sep 11, 2014 at 15:57

2 Answers 2

4

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

0

To add to Renon's answer. I found that using

$order->getCustomerGroupId()

could sometimes cause the logic to break for some templates. I later chose to get the groupid with the below code. Hope it helps someone.

$order = $this->getOrder();
$customerId = $order->getCustomerId();
$customer = Mage::getModel('customer/customer')->load($customerId);

echo $customer->getGroupId();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.