Add order history comment in Magento 1.9

The method used in older version was deprecated.
The new methods are:
– $order->addStatusHistory($historyItem)
– $order->addStatusHistoryComment(“Comment”)

If you also have to set the Customer Notification flag, you should rather use the first option by creating first a Mage_Sales_Model_Order_Status_History object.

$historyItem = new Mage_Sales_Model_Order_Status_History();
$historyItem->setComment(‘Order confirmation e-mail sent by cronjob’);
$historyItem->setIsCustomerNotified(1);
$historyItem->setStatus($order->getStatus());

$order->addStatusHistory($historyItem);
$order->save();

Leave a Reply

Your email address will not be published. Required fields are marked *

Blue Captcha Image
Refresh

*