我试图理解为什么我刚创建的免费送货推车并不适用于所有可用的送货方式。
我有一种免费的送货方式,而另一种(socolissimoflexibilite
)没有变化。
有人可以给我一个提示,解释或一些配置/数据/代码来检查socolissimoflexibilite
送货方式吗?
我的第一次调查引导我进行sales/quote_address_rate
收集:一个费率很好地改为0.00€,但不是另一个。
我还检查了报价送货地址:其free_shipping
字段设置为1。
帮助?
答案 0 :(得分:0)
好的,我找到了答案:
我们有一个扩展模块socolissimoflexibilite
的模块(socolissimosimplicite
)。
socolissimoflexibilite
重写collectRates()
函数,不再支持freeShipping
。我不得不自己重写这部分内容。
对于这个模块遇到同样问题的人来说,这就是诀窍:
在Addonline_SoColissimoFlexibilite_Model_Carrier_ShippingMethod
类中,collectRates()
函数必须替换为此代码:
public function collectRates(Mage_Shipping_Model_Rate_Request $request)
{
$rates = parent::collectRates($request);
$shippingAddress = Mage::getSingleton('checkout/session')->getQuote()->getShippingAddress();
if ($shippingAddress && $shippingAddress->getData('soco_product_code') == 'RDV') {
foreach ($rates->getAllRates() as $rate) {
if ($rate->getCarrier()===$this->_code) {
$rate->setPrice($rate->getPrice()+(int)Mage::getStoreConfig('carriers/socolissimoflexibilite/rdv_fees'));
}
}
}
if($shippingAddress->getFreeShipping()) {
foreach ($rates->getAllRates() as $rate) {
if($rate->getCarrier() === $this->_code) {
$rate->setPrice(0) ;
$rate->setCost(0) ;
}
}
}
return $rates;
}
现在,socolissimoflexibilite
支持freeShipping规则!