magento - 结帐成功后如何发送电子邮件?

标签 magento

在我的商店中,我为一步结账流程创建了一个自定义模块。

所有代码都可以正常工作。但是在结账过程之后,订单详细信息电子邮件不会发送给客户。这是我的代码的相关部分。

$service = Mage::getModel('sales/service_quote', $quote);
$service->submitAll();                          
$order = $service->getOrder();

//This one is the email send code

$order_mail = new Mage_Sales_Model_Order();
$incrementId = Mage::getSingleton('checkout/session')->getLastRealOrderId();
$order_mail->loadByIncrementId($incrementId);
$order_mail->sendNewOrderEmail();               

$this->_redirect('downloadable/customer/products/');

最佳答案

在 magento 中发送/重新发送订单电子邮件

try {

    $incrementId = Mage::getSingleton('checkout/session')->getLastRealOrderId();
    $_order = Mage::getModel('sales/order')->loadByIncrementId($incrementId);
    $_order->sendNewOrderEmail();

    $this->_getSession()->addSuccess($this->__('The order email has been sent.'));

} catch (Exception $e) {
    $this->_getSession()->addError($this->__('Failed to send the order email.'));
    Mage::logException($e);
}

关于magento - 结帐成功后如何发送电子邮件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13176094/

相关文章:

magento - 登录页面的重复内容问题

mysql - 列出过去 12 个月内未订购的 Magento 客户

magento - magento安装过程中文件的权限

magento - 过滤连接的列

magento - 为什么XmlConnect依赖这么多模块?

php - 在 foreach 循环中更正我的自动增量

email - Magento 事务电子邮件配置 : best practice

php - Magento : How to check if admin is logged in within a module controller?

MySQL 全文搜索 1 个字符仅适用于 MyISAM?

magento - 获取magento 2自定义属性值