您好我有一个自定义模块,可以在创建某些订单状态时发送电子邮件。
我有一个挂钩到sales_order_place_after的观察者和我的订单对象sinde observer.php是
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);
}
}
}
但在交易电子邮件{{var order.increment_id}}内部无法正常工作,即使在观察者中我有:$ order = $ observer-> getEvent() - > getOrder();
我错过了什么?感谢。答案 0 :(得分:1)
通常,要发送自定义交易电子邮件,请执行以下操作;
$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);