Reputation: 6168
After some integration issues with Magento, I need to update the status and state of a few orders. However, since these updates are not really relevant for the customer, I do not want the system to send order notification e-mails for each order update in this case.
What does not work:
$historyItem = $order->addStatusHistoryComment('some comment', 'complete');
$historyItem->setIsVisibleOnFront(false);
$historyItem->setIsCustomerNotified(false);
$historyItem->save();
$order->save();
Upvotes: 2
Views: 2523
Reputation: 6168
In Mage_Sales_Model_Order_Status_History
, you can see that the setIsCustomerNotified
method suppresses notification if you provide either parameter null
or the value of the constant Mage_Sales_Model_Order_Status_History::CUSTOMER_NOTIFICATION_NOT_APPLICABLE
. Confusingly, using false
will lead to the notification being sent.
This code block works - revise order status, adding a comment that is visible only on the backend and will not trigger a notification e-mail to the client:
$historyItem = $order->addStatusHistoryComment('some comment', 'complete');
$historyItem->setIsVisibleOnFront(false);
$historyItem->setIsCustomerNotified(Mage_Sales_Model_Order_Status_History::CUSTOMER_NOTIFICATION_NOT_APPLICABLE);
$historyItem->save();
$order->save();
Upvotes: 3