开发者

Magento grouped products label question

Magento grouped products label question

I have tier pricing setup for one of my products in Magento. Is there any way to change the "Buy 2 for $321.60 each" to "Buy 2-4 for $321.60 each" a开发者_高级运维nd "Buy 5+ for $205.52 each"? It won't always be these numbers (could be "Buy 3-4" or something).


The display logic for tier prices is located in app/design/frontend/watercare/default/template/catalog/product/view/tierprices.phtml

Replace the last else block with:

<?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']);
?>

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


a quick fix to the code above (It wasn't working correctly for me in 1.7.0.2) $_qty would stay the same for all the tiers a fix would be.

<?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']);
?>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜