是否可以删除除运费 0 之外的所有shipping methods
?
可能会有一个promotion rule
会返回 0 的数量,因此不能删除。
答案 0 :(得分:0)
Display only shipping methods with price 0 (zero) if any
在我的模块中,我将Mage_Checkout_Block_Onepage_Shipping_Method_Available
块重写为:
<强> config.xml中强>
<global>
<blocks>
<checkout>
<rewrite>
<onepage_shipping_method_available>Excellence_Subscription_Block_Checkout_Onepage_Shipping_Method_Available</onepage_shipping_method_available>
</rewrite>
</checkout>
</blocks>
</global>
<强> Excellence_Subscription_Block_Checkout_Onepage_Shipping_Method_Available 强>
<?php
class Excellence_Subscription_Block_Checkout_Onepage_Shipping_Method_Available extends Mage_Checkout_Block_Onepage_Shipping_Method_Available {
public function getShippingRates() {
$groups = parent::getShippingRates();
$free = array();
foreach ($groups as $code => $_rates) {
foreach ($_rates as $_rate) {
if (!$_rate->getPrice() > 0) {
$free[$code] = $_rates;
}
}
}
if (!empty($free)) {
return $this->_rates = $free;
}
return $groups;
}
}