以现有顺序以编程方式更改Magento运输方式

时间:2012-10-12 10:40:53

标签: magento

我尝试在订单中设置任意送货方式。 (在管理区域)

$order = Mage::getModel('sales/order')->load($orderId);
$order->getShippingAddress()->setShippingMethod('shipping_method');
$order->save();

当我打电话

Mage::log($order->getShippingAddress()->getShippingMethod());

我得到shipping_method,但送货方式不会改变。

2 个答案:

答案 0 :(得分:0)

更改送货方式也会导致对成本和服务的各种更改。还需要检查装运方法是否对订单有效。因此,据我所知,现有订单的内置系统没有简单的方法。

如果您真的只想修改送货方式,我认为您应该直接查询数据库。

答案 1 :(得分:0)

如果您想设置送货方式,您应该输入以下内容:

$order->setShippingMethod('flatrate_flatrate');

对于扁平运输方式,您应该采用任何运输方式。

相关问题