2011-09-08 125 views
0

magentoMagento分组产品标签问题

我对Magento中的其中一个产品有定价设置。有没有办法将“每个321.60美元购买2”改为“每个购买321美元2-4美元”和“每个205.52美元购买5美元”?这并不总是这些数字(可能是“买3-4”或什么的)。

回答

1

对于方法的价格显示逻辑位于app/design/frontend/watercare/default/template/catalog/product/view/tierprices.phtml

替换为最后else块:

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