Email 在Magento中创建发票和电子邮件

Email 在Magento中创建发票和电子邮件,email,magento,invoice,Email,Magento,Invoice,我想在Magento中自动创建发票和电子邮件。发票创建似乎工作,但我有得到电子邮件部分的工作 Mage::app(); $order = Mage::getModel('sales/order')->loadByIncrementId($orderid); try { if(!$order->canInvoice()) { Mage::throwException(Mage:

我想在Magento中自动创建发票和电子邮件。发票创建似乎工作,但我有得到电子邮件部分的工作

 Mage::app();       
    $order = Mage::getModel('sales/order')->loadByIncrementId($orderid);

    try 
    {
        if(!$order->canInvoice())           {   
            Mage::throwException(Mage::helper('core')->__('Cannot create an invoice.'));
        }

        $invoice = Mage::getModel('sales/service_order', $order)->prepareInvoice();

        if (!$invoice->getTotalQty()) {
            Mage::throwException(Mage::helper('core')->__('Cannot create an invoice without products.'));
        }

        $invoice->setRequestedCaptureCase(Mage_Sales_Model_Order_Invoice::CAPTURE_ONLINE);
        $invoice->register();
        $transactionSave = Mage::getModel('core/resource_transaction')
            ->addObject($invoice)
            ->addObject($invoice->getOrder());
        $transactionSave->save();
    }       
    catch (Mage_Core_Exception $e) {

    }
}

我知道我的反应有点晚,但对于找到此页面的其他人:

您需要添加发送电子邮件的代码。 在寄存器行之后执行此操作:



SetCustomerNotify用于说明客户是否必须收到电子邮件


setIsInProcess将订单状态更改为processing

我知道我的反应有点晚,但对于找到此页面的其他人:

您需要添加发送电子邮件的代码。 在寄存器行之后执行此操作:



SetCustomerNotify用于说明客户是否必须收到电子邮件


setIsInProcess将订单状态更改为processing

查看此链接可能有助于Rachel您可能需要使用google translate进行翻译查看此链接可能有助于Rachel您可能需要使用google translate进行翻译
$invoice->register();
$invoice->getOrder()->setCustomerNoteNotify(true);
$invoice->getOrder()->setIsInProcess(true);
$invoice->sendEmail();