我已经安装了 iwd_onepagecheckout extension .
客户可以向他们的订单添加评论。
现在我想将此“评论”添加到订单电子邮件中。评论将保存在表 sales_flat_order_status_history
中,其中包含以下列:
entity_id, parent_id, is_customer_notified, is_visible_on_front, comment, status, created_at, entity_name
我搜索了论坛,但找不到如何执行此操作。
最佳答案
上面的答案是正确的。但是它重复了管理面板中的评论。您在未通知客户的情况下发表了一次评论,在通知客户后又发表了第二次评论。
您需要注释或删除行 $data['order']->addStatusHistoryComment($comment)->setIsVisibleOnFront(true)->setIsCustomerNotified(false);
因为它会添加注释到管理端的订单页面,但它不会通知客户。
所以最终的脚本应该是:
public function addHistoryComment($data)
{
$comment = Mage::getSingleton('customer/session')->getOrderCustomerComment();
$comment = trim($comment);
if (!empty($comment))
{
$order = $data->getEvent()->getOrder();
$order->setCustomerComment($comment);
$order->setCustomerNoteNotify(true);
$order->setCustomerNote($comment);
}
}
关于php - Magento 将现有评论添加到订单电子邮件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12510808/