下单时如何自动在订单上添加评论


11

我有以下情况:

我在结帐页面上,我有3种送货方式。如果我从3中选择一种特定的方法并完成订单,则希望从该区域的后端自动在订单视图上添加评论:

在此处输入图片说明

有谁知道我该怎么做?

Answers:


9

您将需要创建一个event-observer模块并进行观察sales_order_place_after

您的观察者方法如下所示:

public function logShipping($observer){
    $order = $observer->getEvent()->getOrder();
    $history = $order->addStatusHistoryComment($order->getShippingMethod(), false);
    $history->setIsCustomerNotified(false);
    $order->save();
}
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.