0
votes

Hi I have a custom Module built that sends an email when certain order statues are being created.

I have an observer that hooks into sales_order_place_after and my order object sinde observer.php is

   public function getOrderStatus($observer)
 {
   $order = $observer->getEvent()->getOrder();
   $status = $order->getStatus();
   $enabled = Mage::getStoreConfig(self::XML_PATH_EMAIL_ENABLE);
   if($enabled == 1){
       if($status  === "fraud")
       {
        $this->sendFraudEmail($observer);
       }
 }

}

but inside the transactional emails {{var order.increment_id}} is not working, even though in the observer I have : $order = $observer->getEvent()->getOrder();

what am I missing? Thanks.

1
Can you post your full code specifically the sendFraudEmail() method you are calling. You need to parse through an array of the objects you wish to use in the transactional email. - Ashley Swatton
can you give me a sample of how the array I am passing through should look like? - user1920187
thanks for setting me on the right tracks, I missed the array inside send transactional() like this: ->sendTransactional( /* ... ... .. .. */ array( 'order' => $this->getOrder(), - user1920187

1 Answers

1
votes

Normally to send a custom transactional email you do something like the following;

$templateId = 16;

$sender  = array(
    'name' => Mage::getStoreConfig('trans_email/ident_support/name', Mage::app()->getStore()->getId()),
    'email' => Mage::getStoreConfig('trans_email/ident_support/email', Mage::app()->getStore()->getId())
);

$vars = array('order' => $observer->getEvent()->getOrder());

Mage::getModel('core/email_template')->sendTransactional($templateId, $sender, $customerEmail, $customerName, $vars, $storeId);