如何在不触发通知电子邮件的情况下更新Magento订单状态? [英] How to update Magento order status without triggering notification email?
问题描述
在与Magento发生某些集成问题之后,我需要更新一些订单的状态和状态.但是,由于这些更新与客户并没有真正的关联,因此在这种情况下,我不希望系统为每个订单更新发送订单通知电子邮件.
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.
什么不起作用:
$historyItem = $order->addStatusHistoryComment('some comment', 'complete');
$historyItem->setIsVisibleOnFront(false);
$historyItem->setIsCustomerNotified(false);
$historyItem->save();
$order->save();
推荐答案
在Mage_Sales_Model_Order_Status_History
中,如果提供参数null
或常量Mage_Sales_Model_Order_Status_History::CUSTOMER_NOTIFICATION_NOT_APPLICABLE
的值,则可以看到setIsCustomerNotified
方法禁止显示通知. .令人困惑的是,使用false
会导致发送通知.
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();
这篇关于如何在不触发通知电子邮件的情况下更新Magento订单状态?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!