I want to update the status of quite a few orders in bulk from pending to complete, and hence I am trying to do it in a programmatic way as there is no option in magento backend, for updating the status in bulk by using the method below.

$order = Mage::getModel('sales/order')->loadByIncrementId('100010175');
        //$order->setState(Mage_Sales_Model_Order::STATE_COMPLETE, true);
        $order->setData('state', "complete");
        $history = $order->addStatusHistoryComment('Order was set to Complete by our automation tool.', false);

But when I update the status using the above method, only the status is getting updated to complete. But the order amount is not getting added up to the lifetime sales, that shows up on the dashboard main page.

Can anyone let me know, how the order amount also can be updated to the lifetime sales total, with the updating of the status of the order too?

1 Answer 1


The the order amount will be added to life time sales only if the invoice of the order is generated. So you need to create the invoice of the order also.

You can programmatically generate invoice of order by using the code given below.

    $invoice = $order->prepareInvoice();                
    $order->addStatusToHistory(Mage_Sales_Model_Order::STATE_PROCESSING,'Invoice generated successfully.');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.