1
votes

When a customer pays, partially or fully, by coupon code the order status is set to "Pending Payment". We use a third party order management application which only pulls in orders with the status "Processing".

Normal orders are automatically set to "Processing", so it's only when a coupon code is used that we have a problem.

Is there a way of automatically updating the order status to "Processing" when a customers applies a coupon code?

Thanks for your help

(Magento Community 1.7)

1
Check where the order status is changed to "Pending Payment" in coupon code module, I think you should change it to "Processing" there itself.Kalpesh

1 Answers

0
votes

I think this is possible, but you might have to combine it with creating an invoice - since the coupon amount covers the order value and the order is technically paid. I would create an observer to catch sales_order_place_after and use it for the following:

$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();