首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >Magento分组产品标签问题

Magento分组产品标签问题
EN

Stack Overflow用户
提问于 2011-09-09 02:47:21
回答 2查看 359关注 0票数 0

我有一个我的产品在Magento的层级定价设置。有没有办法将“购买2个321.60美元”改为“购买2-4个321.60美元”和“购买5+每个205.52美元”?它不会总是这些数字(可能是“购买3-4”或其他东西)。

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2011-09-14 01:32:53

阶梯价格的显示逻辑位于app/design/frontend/watercare/default/template/catalog/product/view/tierprices.phtml

将最后一个else块替换为:

代码语言:javascript
运行
复制
<?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
EN

Stack Overflow用户

发布于 2012-08-24 02:57:53

对上面代码的快速修复(在我的1.7.0.2版本中它不能正常工作) $_qty对于修复的所有层都是相同的。

代码语言:javascript
运行
复制
<?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']);
?>
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/7352978

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档