Skip to content

Commit

Permalink
Resolve PHOENIX-MEDIA#19: Fix order status after automatic invoicing
Browse files Browse the repository at this point in the history
  • Loading branch information
PhoenixDev - JJ committed Apr 11, 2018
1 parent 1291ed9 commit 7ef3339
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions app/code/community/Phoenix/CashOnDelivery/Model/Observer.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ public function order_cancel_after(Varien_Event_Observer $observer)
*/
public function invoice_cashondelivery($observer)
{
/** @var Mage_Sales_Model_Order $order */
$order = $observer->getEvent()->getOrder();

if ($order->getPayment()->getMethodInstance()->getCode() === 'phoenix_cashondelivery'
Expand All @@ -131,6 +132,10 @@ public function invoice_cashondelivery($observer)
$invoice->setRequestedCaptureCase(Mage_Sales_Model_Order_Invoice::CAPTURE_OFFLINE);
$invoice->register();

$orderState = Mage_Sales_Model_Order::STATE_PROCESSING;
$invoice->getOrder()->setState($orderState)
->setStatus($order->getConfig()->getStateDefaultStatus($orderState));

$transactionSave = Mage::getModel('core/resource_transaction')
->addObject($invoice)
->addObject($invoice->getOrder());
Expand Down

0 comments on commit 7ef3339

Please sign in to comment.