我有一个我的产品在Magento的层级定价设置。有没有办法将“购买2个321.60美元”改为“购买2-4个321.60美元”和“购买5+每个205.52美元”?它不会总是这些数字(可能是“购买3-4”或其他东西)。
发布于 2011-09-14 01:32:53
阶梯价格的显示逻辑位于app/design/frontend/watercare/default/template/catalog/product/view/tierprices.phtml
中
将最后一个else
块替换为:
<?php
$_format = 'Buy %1$s for %2$s each';
if($index === count($_tierPrices) - 1)
{
$_format = 'Buy %1$s+ for %2$s each';
}
else
{
$_next = $_tierPrices[$index + 1];
$_qty = $_next['price_qty'] - 1;
if($_qty > 0) $_format = 'Buy %1$s-' . $_qty . ' for %2$s each';
}
echo $this->__($_format, $_price['price_qty'], $_price['formated_price']);
?>
这将确保最后一个层级价格始终为{num}+
,而之前的层级价格为
2 - {num - 1}
。
发布于 2012-08-24 02:57:53
对上面代码的快速修复(在我的1.7.0.2版本中它不能正常工作) $_qty对于修复的所有层都是相同的。
<?php
$_format = 'Buy %1$s for %2$s each';
if($index === count($_tierPrices) - 1)
{
$_format = 'Buy %1$s+ for %2$s each';
}
else
{
$i = $i + 1;
$_next = $_tierPrices[$index + $i];
$_qty = $_next['price_qty'] -1;
if($_qty > 0) $_format = 'Buy %1$s-' . $_qty . ' for %2$s each';
}
echo $this->__($_format, $_price['price_qty'], $_price['formated_price']);
?>
https://stackoverflow.com/questions/7352978
复制相似问题