且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Magento分组产品标签问题

更新时间:2023-11-30 12:12:04

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

The display logic for tier prices is located in 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}.

This will make sure that the last tier price will always be {num}+ and the ones before it will be
2 - {num - 1}.