Magento分组产品标签问题

时间:2011-09-08 18:47:21

标签: magento

magento

我在Magento的某个产品上设置了套餐定价。有没有什么方法可以将“买2送$ 321.60”更改为“买2-4送$ 321.60”和“买5送$ 205.52”?它并不总是这些数字(可能是“买3-4”或其他东西)。

2 个答案:

答案 0 :(得分:1)

等级价格的显示逻辑位于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}

答案 1 :(得分:1)

快速修复上面的代码(在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']);
?>