0

製品リストの通常価格に近い tier_price の数量フィールドを表示する必要があります (最低の tier_price の最大数量)。製品リストの $_product->getTierPrice() は、'tier_price'=>xxx および 'qty'=>1 の array(1) を提供します (xxx は階層価格の最低値です)。商品リストの tier_price の数量を取得することはできますか?

PS。商品ビューでは、$_product->getTierPrice() を使用して階層価格の配列を確認できます。

マジェント CE 1.7.0.2

4

2 に答える 2

1

このコードを list.phtml または view.phtml に配置して、各数量の階層価格を表示できます。

$attribute = $_product->getResource()->getAttribute('tier_price');
$currency_code = Mage::app()->getStore()->getCurrentCurrencyCode();
$symbol = Mage::app()->getLocale()->currency(Mage::app()->getStore()->getCurrentCurrencyCode())->getSymbol();
if ($attribute) {
    $attribute->getBackend()->afterLoad($_product);
    $tierPrices = $_product->getTierPrice();

    foreach($tierPrices as $tierPrice)
    {
    ?>
    <span class="priceqty"><?php echo '+'.round($tierPrice["price_qty"], 0);?></span><br>
    <span class="pricetitle"><?php echo $symbol.number_format($tierPrice["price"], 2, '.', '');?></span>
<?php  
    } 
} 
?>
于 2015-07-20T12:42:45.777 に答える