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.
require_once('app/Mage.php');
Mage::app();
Mage::init();
$order = Mage::getModel('sales/order')->loadByIncrementId('100010175');
//$order->setState(Mage_Sales_Model_Order::STATE_COMPLETE, true);
$order->setData('state', "complete");
$order->setStatus("complete");
$history = $order->addStatusHistoryComment('Order was set to Complete by our automation tool.', false);
$history->setIsCustomerNotified(false);
$order->save();
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?