我已经提交了两种送货方式。 表格 2.免费送货
我只需要显示单一送货方式,并且还启用两种送货方式。我在app \ code \ core \ Mage \ Checkout \ Block \ Onepage \ Shipping \ Method \ Available.php中自定义代码
if (!empty($groups)) {
$ratesFilter = new Varien_Filter_Object_Grid();
$ratesFilter->addFilter(Mage::app()->getStore()->getPriceFilter(), 'price');
$custom = array();
$k=0;
foreach ($groups as $code => $groupItems) {
$custom['shippingmethod'][$k] = $code;
$k++;
}
$check = array('tablerate','freeshipping');
if(in_array($check,$custom)){
foreach ($groups as $code => $groupItems) {
if($code == 'tablerate')
$groups[$code] = $ratesFilter->filter($groupItems);
}
} else {
foreach ($groups as $code => $groupItems) {
$groups[$code] = $ratesFilter->filter($groupItems);
}
}
}
但它不给我运费方式的价格。还有其他解决办法吗?
答案 0 :(得分:5)
您可以在前端模板中自定义此功能。您将不得不更改app / design / frontend / _your_package _ / _ your_theme_ / template / checkout / onepage / shipping_method / available.phtml
我想你只想展示免费送货。当无法使用免费提供时,无论如何都不应该显示。
原始代码:
<dl class="sp-methods">
<?php $shippingCodePrice = array(); ?>
新代码:
<dl class="sp-methods">
<?php
$showFreeShipping = false;
$_shippingRateGroupsReduced = array();
foreach ($_shippingRateGroups as $code => $_rates) {
if(strstr($code, 'freeshipping')) {
$showFreeShipping = true;
$_shippingRateGroupsReduced[$code] = $_shippingRateGroups[$code];
}
}
if($showFreeShipping) {
$_shippingRateGroups = $_shippingRateGroupsReduced;
}
?>
<?php $shippingCodePrice = array(); ?>