Magento:不同格式的旧价格为特定的制造商


magento: different format of old price for specific manufacturer

我希望有不同格式的旧价格的产品,如果它有一个特定的制造商(如苹果)。

我想我必须在p class="old-price" on/template/catalog/product/price.html上添加一些类似的东西,但我很确定这是错误的:

<?php $manufacturer = Mage::getModel('catalog/product');?>
<?php if ($manufacturer && in_array($manufacturer = $product->getAttributeText('manufacturer'), array('Apple')) : ?>

有什么想法吗?

假设manufacturer是一个产品属性,并且您在指定的路径中使用默认的Magento模板之一,您应该已经在$_product中加载了产品模型,并且您可以通过以下魔术方法使用制造商:

$manufacturer = $_product->getManufacturer();

实现可能是这样的:

<?php $isOldPrice = (in_array($_product->getManufacturer(), array('Apple'))); ?>
<p<?php if ($isOldPrice) : ?> class="old-price"<?php endif; ?>>Your price here</p>

正确的语法是:

<?php $manufacturer = $_product->getAttributeText('manufacturer');?>
<?php if ($manufacturer && in_array($_product->getAttributeText('manufacturer'), array('Apple'))) : ?>