2011-09-08 8 views
0

magentoMagento 그룹 제품 라벨 질문

Magento에서 제 제품 중 하나에 대한 가격 설정이 있습니다. "각각 2 달러 321.60 달러를"2 유로를 각각 321.60 달러에 구입하고 "5 달러를 각각 205.52 달러에 구입"으로 변경할 수있는 방법이 있습니까? 항상이 숫자가 아닐 수 있습니다 ("Buy 3-4"또는 뭔가있을 수 있음).

답변

1

는 계층 가격의 표시 논리와 마지막 else 블록을 교체 app/design/frontend/watercare/default/template/catalog/product/view/tierprices.phtml

에 있습니다

<?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}입니다.

1

위의 코드에 대한 빠른 수정 (1.7.0.2에서 올바르게 작동하지 않음) $ _qty는 수정 사항이 적용되는 모든 티어에서 동일하게 유지됩니다.

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