well, the actual way to make COMPLETE
order state is to create invoice
and shipment
, after which state state automatically gets COMPLETE
state. How:
//create invoice for the order $invoice = $order->prepareInvoice() ->setTransactionId($order->getId()) ->addComment("Invoice created from cron job.") ->register() ->pay(); $transaction_save = Mage::getModel('core/resource_transaction') ->addObject($invoice) ->addObject($invoice->getOrder()); $transaction_save->save(); //now create shipment //after creation of shipment, the order auto gets status COMPLETE $shipment = $order->prepareShipment(); if( $shipment ) { $shipment->register(); $order->setIsInProcess(true); $transaction_save = Mage::getModel('core/resource_transaction') ->addObject($shipment) ->addObject($shipment->getOrder()) ->save(); }
source share