且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在不触发通知电子邮件的情况下更新Magento订单状态?

更新时间:2023-11-30 08:18:04

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();