我的问题是,当我试图从结帐时,它将应用正确的总折扣在底部的magento管理订单页面的订单,但行项目显示$0折扣。
例如,假设我有一个促销活动,每件东西都有50%的折扣,有人买了2件商品,苹果10美元,橙色5美元,购物车总数是15 - 50% =7.50美元,这已经发生了,但是当你查看行项目时,这两个折扣都设置为0美元,它应该是: apple数量:1价格$10折扣$5总计$5橙色数量:1价格$5折扣2.50总计2.50美元;以下是我的代码:
$couponCode = (string) $this->getRequest()->getParam('coupon_code');
if ($this->getRequest()->getParam('remove') == 1) {
$couponCode = '';
}
$oldCouponCode = $this->_getQuote()->getCouponCode();
if (!strlen($couponCode) && !strlen($oldCouponCode)) {
$this->_goBack();
return;
}
try {
$this->_getQuote()->getShippingAddress()->setCollectShippingRates(true);
$this->_getQuote()->setCouponCode(strlen($couponCode) ? $couponCode : '')
->collectTotals()
->save();
if ($couponCode) {
if ($couponCode == $this->_getQuote()->getCouponCode()) {
$this->_getSession()->addSuccess(
$this->__('Coupon code "%s" was applied.', Mage::helper('core')->htmlspecialchars($couponCode))
);
}
else {
$this->_getSession()->addError(
$this->__('Coupon code "%s" is not valid.', Mage::helper('core')->htmlspecialchars($couponCode))
);
}
} else {
$this->_getSession()->addSuccess($this->__('Coupon code was canceled.'));
}
echo $this->_getReviewHtml();
exit;发布于 2013-08-02 02:08:34
购物车促销规则是针对每个项目的折扣还是针对整个订单的折扣?
代码本身看起来没问题。
您可能还希望为检出会话添加。
Mage::getSingleton("checkout/session")->setData("coupon_code",strlen($couponCode));https://stackoverflow.com/questions/18000897
复制相似问题