0

多数の Magento 製品の階層価格設定があり、それらの表示方法を変更したいと考えています。現在、「x の金額で 1 個購入」と表示されているだけで、範囲が適切に説明されていません。とにかく、「それぞれ x の量で 1 ~ 9 を購入する」という行に沿って何かを言わせることはありますか。たとえば、製品ごとに約5つの層を探しています。

Buy 10-19 for £3.32 each
Buy 20-49 for £2.99 each
Buy 50-99 for £2.39 each
Buy 100-199 for £2.39 each
Buy 200-299 for £2.39 each

これらの数値は製品によって異なることに注意してください。

最初の層でこれを見事に行う方法を説明する回答済みの質問を見つけましたが、すべての層で機能するにはこれが必要です。おそらくループ内ですか?

Magento グループ化された製品ラベルに関する質問

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

このコードをどのようにループさせて、すべての層に影響を与えるでしょうか。

ありがとう

4

1 に答える 1

1

それを行うための簡単な修正

<?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']);
?> 
于 2012-08-27T19:20:11.413 に答える