订单提交后发送邮件
来源:互联网 发布:淘宝店铺装修工具 编辑:程序博客网 时间:2024/05/21 16:55
\app\code\local\Lotusbreath\OneStepCheckout\controllers\IndexController.php
public function savePostAction() { if($this->_expireAjax()){ return false; } $updateItems = array(); $previousData = $this->getRequest()->getPost(); $results = $this->process(array( 'billing' => array(), 'shipping' => array(), 'shipping_method' => array(), 'payment_method' => array() ), true ); $isHasErrors = false; foreach ($results as $stepIdx => $stepResult){ if (!empty($stepResult['error'])){ $isHasErrors = true; switch ($stepIdx){ case 'shipping_method': $updateItems[] = 'shipping_partial'; break; case 'payment': $updateItems[] = 'payment_partial'; break; case 'billing': $updateItems[] = 'billing_partial'; break; case 'shipping': $updateItems[] = 'shipping_address_partial'; break; } } } if (!$isHasErrors){ if (!empty($results['payment']['redirect'])) { //do not save order if ($data = $this->getRequest()->getPost('payment', false)) { $this->getOnepage()->getQuote()->getPayment()->importData($data); } $this->getCheckoutService()->updateQuote();// 发送邮件 $service = Mage::getModel('sales/service_quote', $this->getOnepage()->getQuote()); $order = $service->getOrder(); if ($order->getCanSendNewEmailFlag()) { try { $order->queueNewOrderEmail(); } catch (Exception $e) { Mage::logException($e); } } }else{ $saveOrderResult = $this->getCheckoutService()->submitOrder(); $results['save_order'] = $saveOrderResult; if ($saveOrderResult['success'] == false) { $updateItems[] = "review_partial"; } } }else{ $this->getCheckoutService()->updateQuote(); } $return = array( 'results' => $results, 'previous_data' => $previousData, 'update_items' => $updateItems, 'success' => !empty($saveOrderResult['success']) ? $saveOrderResult['success'] : false, 'error' => !empty($saveOrderResult['error']) ? $saveOrderResult['error'] : false, ); if (count($updateItems)) { foreach ($updateItems as $updateItem) { $return['htmlUpdates'][$updateItem] = $this->_getUpdateItem($updateItem); } }// $this->update_customer_points(); $this->getResponse() ->clearHeaders() ->setHeader('Content-Type', 'application/json') ->setBody(Mage::helper('core')->jsonEncode($return)); }C:\website2\woowj\web\app\code\core\Mage\Checkout\Model\Type\Onepage.php
/** * Create order based on checkout type. Create customer if necessary. * * @return Mage_Checkout_Model_Type_Onepage */ public function saveOrder() { $this->validate(); $isNewCustomer = false; switch ($this->getCheckoutMethod()) { case self::METHOD_GUEST: $this->_prepareGuestQuote(); break; case self::METHOD_REGISTER: $this->_prepareNewCustomerQuote(); $isNewCustomer = true; break; default: $this->_prepareCustomerQuote(); break; } $service = Mage::getModel('sales/service_quote', $this->getQuote()); $service->submitAll(); if ($isNewCustomer) { try { $this->_involveNewCustomer(); } catch (Exception $e) { Mage::logException($e); } } $this->_checkoutSession->setLastQuoteId($this->getQuote()->getId()) ->setLastSuccessQuoteId($this->getQuote()->getId()) ->clearHelperData(); $order = $service->getOrder(); if ($order) { Mage::dispatchEvent('checkout_type_onepage_save_order_after', array('order'=>$order, 'quote'=>$this->getQuote())); /** * a flag to set that there will be redirect to third party after confirmation * eg: paypal standard ipn */ $redirectUrl = $this->getQuote()->getPayment()->getOrderPlaceRedirectUrl(); /** * we only want to send to customer about new order when there is no redirect to third party */// if (!$redirectUrl && $order->getCanSendNewEmailFlag()) { if ($order->getCanSendNewEmailFlag()) { try { $order->queueNewOrderEmail(); } catch (Exception $e) { Mage::logException($e); } } // add order information to the session $this->_checkoutSession->setLastOrderId($order->getId()) ->setRedirectUrl($redirectUrl) ->setLastRealOrderId($order->getIncrementId()); // as well a billing agreement can be created $agreement = $order->getPayment()->getBillingAgreement(); if ($agreement) { $this->_checkoutSession->setLastBillingAgreementId($agreement->getId()); } } // add recurring profiles information to the session $profiles = $service->getRecurringPaymentProfiles(); if ($profiles) { $ids = array(); foreach ($profiles as $profile) { $ids[] = $profile->getId(); } $this->_checkoutSession->setLastRecurringProfileIds($ids); // TODO: send recurring profile emails } Mage::dispatchEvent( 'checkout_submit_all_after', array('order' => $order, 'quote' => $this->getQuote(), 'recurring_profiles' => $profiles) ); return $this; }
阅读全文
0 0
- 订单提交后发送邮件
- 提交订单系统自动发送邮件到收件人邮箱优化(定时发送邮件)
- 自用Git提交后自动发送邮件的脚本
- 提交订单系统自动发送邮件到收件人邮箱优化(邮件内容信息以月为单位)
- 采购订单邮件发送预警设置
- dede 提交表单 发送邮件
- magento修改发送邮件内容和订单邮件提醒设置
- 提交订单系统自动发送邮件到收件人邮箱优化(邮件正文内容为当天数据,附件内容为当月数据)
- DedeCMS提交自定义表单后自动发送邮件到站长邮箱的方法
- jenkins构建后邮件发送
- jenkins构建后邮件发送
- jenkins构建后邮件发送
- 提交订单系统自动发邮件到收件人邮箱
- ZenCart给顾客发送的订单(更新)确认邮件内容
- 【js与jquery】订单提交页发送短信功能
- 【js与jquery】订单提交页发送短信功能
- 【js与jquery】订单提交页发送短信功能
- 网页Javascript提交OutLook发送邮件
- RocketMQ概念模型
- Target runtime Apache Tomcat v7.0 is not defined.
- CRC循环冗余校验码
- PHP一致性Hash
- js 基础点(checkbox选中,时间大小,查询数组值,form重复提交)
- 订单提交后发送邮件
- 冲刺NOI2017 (20) 距离 (可持久化树链剖分)
- python/pip /conda 不是内部或外部的命令
- Code资格赛2
- 爆炸
- CST时间转换出现的误差问题
- 『pandas』pandas查漏补缺
- 基于树莓派的空气监测系统(3)PM2.5模块程序
- 解决ssd训练时出的问题