我创建了一个目录定价规则,它在从前端下订单时工作正常。但是,当我通过自定义代码以编程方式创建订单时,发现此规则不起作用,尽管我将此特定订单分配给属于所提供客户组的客户。有人可以帮忙吗?请参阅以下相关代码:
....
//Setting customer group ID
$this->_quote->setCustomerGroupId(9);
...
............
//$currentProduct - product Object
//$curQuantity - Product quantity
$this->_quote->addProduct($currentProduct,new Varien_Object(array('qty'=> $curQuantity)));
.............
谢谢! 伊克巴尔。
答案 0 :(得分:0)
要以编程方式将目录定价规则应用于引用对象,请使用此
Mage::getSingleton('checkout/cart')
->getQuote()
->setCouponCode(strlen($couponCode) ? $couponCode : '')
->collectTotals()
->save();