I was wondering if it is possible to change the email template after the order is placed depending on a shipping or payment method. I built the observer here:
config.xml
<events>
<sales_order_place_after>
<observers>
<send_dropshipping_email>
<type>singleton</type>
<class>Salamanda_Dropshipping_Model_Dropshipping</class>
<method>send_email</method>
</send_dropshipping_email>
</observers>
</sales_order_place_after>
</events>
And also in the model php file:
demo.php
public static function send_email($observermail)
{
$event = $observermail->getEvent();
$order = $event->getOrder();
$customer = $order->getCustomerName();
$email= $order->getCustomerEmail();
$templateId = 1;
$senderName = Mage::getStoreConfig('trans_email/ident_support/name');
$senderEmail = Mage::getStoreConfig('trans_email/ident_support/email');
$sender = array('name' => $senderName,
'email' => $senderEmail);
$storeId = Mage::app()->getStore()->getId();
$vars = array('customerName' => $email,
'customerEmail' => $customer);
$translate = Mage::getSingleton('core/translate');
Mage::getModel('core/email_template')
->sendTransactional($templateId, $sender, $email, $customer, $vars, $storeId);
$translate->setTranslateInline(true);
Mage::log($customer);
}
I was able to send another email template when the customer places an order. But the old transactional email template is also sent to the customer (the customer gets two different emails).
How can I get the original template on this event and change it to my template....or at least disable the old email template if this shipping/payment method is used?