2013-09-30 1 views
0

tier_price의 qty 필드를 제품 목록의 정상 가격 근처에 표시해야합니다 (최저 tier_price의 최고 수량). 이제 제품 목록의 $ _product-> getTierPrice()는 'tier_price'=> xxx 및 'qty'=> 1 (여기서 xxx는 내 계층 가격 중 가장 낮은 값) 인 array (1)을 제공합니다. 제품 목록에서 tier_price에 대한 수량을 확보 할 수 있습니까?tier_price의 제품 목록에 표시 할 내용을

추신. 제품보기에서 $ _product-> getTierPrice()를 사용하여 계층 가격의 배열을 볼 수 있습니다.

젠토 CE는 1.7.0.2

답변

0

당신이 젠토의 방법을 찾고 있다면 :

$attribute = $_product->getResource()->getAttribute('tier_price'); 

    if ($attribute) { 
     $attribute->getBackend()->afterLoad($_product); 
     $tierPrices = $_product->getTierPrice(); 
    } 

getTierPrice()

/app/code/core/Mage/Catalog/Model/Product/Type/Price.php에서 나는 젠토 1.4.0.2에서 테스트 한 (그것은에서도 작동합니다 다른 버전) 카테고리 페이지에서 작동합니다.

SQL 모양으로보고 싶다면 Magento: Display tier prices at category listing page

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 
    } 
} 
?>