我正在尝试仅在付款成功时向卖家发送订单电子邮件。我试过以下事件。
sales_order_place_after,sales_order_save_after,checkout_onepage_controller_success_action
我正在使用以下代码根据订单状态发送电子邮件,例如
if($order->getState() == Mage_Sales_Model_Order::STATE_PROCESSING){
$emailTemp = Mage::helper('marketplace')->getOrderPlaceNotifymailTemplate();
$emailTempVariables = array();
$emailTempVariables['myvar1'] = $order->getRealOrderId();
$emailTempVariables['myvar2'] = $order['created_at'];
$emailTempVariables['myvar4'] = $billinginfo;
$emailTempVariables['myvar5'] = $payment;
$emailTempVariables['myvar6'] = $shipping_info;
$emailTempVariables['myvar9'] = $shipping_des;
$emailTempVariables['myvar8'] = $orderinfo;
$emailTempVariables['myvar3'] = $Username;
$processedTemplate = $emailTemp->getProcessedTemplate($emailTempVariables);
$emailTemp->setSenderName($adminUsername);
$emailTemp->setSenderEmail($adminEmail);
$emailTemp->send($useremail,$Username,$emailTempVariables);
}
但我无法发送电子邮件,即使我尝试使用
发送if($ order-> getBaseTotalDue()== 0){ .......电子邮件代码......... }
如果我移除{}条件即使我取消付款网关上的付款我也可以发送电子邮件。我需要纠正这个问题,我只有在付款成功时才需要发送电子邮件。