1

当客户通过优惠券代码部分或全部付款时,订单状态设置为“待付款”。我们使用第三方订单管理应用程序,它只提取状态为“处理中”的订单。

正常订单会自动设置为“处理中”,因此只有使用优惠券代码时才会出现问题。

当客户应用优惠券代码时,是否有办法自动将订单状态更新为“处理中”?

谢谢你的帮助

(Magento 社区 1.7)

4

1 回答 1

0

我认为这是可能的,但您可能必须将其与创建发票结合起来——因为优惠券金额涵盖了订单价值,并且从技术上讲,订单已支付。我将创建一个观察者来捕获sales_order_place_after并将其用于以下目的:

$order = $observer->getOrder();
/**
add code to check if the coupon amount covers the order value
*/
$invoice = Mage::getModel('sales/service_order', $order)->prepareInvoice();
$invoice->register();
$invoice->getOrder()->setIsInProcess(true);
$invoice->getOrder()->setState(Mage_Sales_Model_Order::STATE_PROCESSING, true, '', false);
$transactionSave = Mage::getModel('core/resource_transaction')
    ->addObject($invoice)
    ->addObject($invoice->getOrder());
$transactionSave->save();
$invoice->getOrder()->save();
于 2013-01-28T13:42:30.523 回答