Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/233.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php magento:特定制造商的旧价格的不同格式_Php_Magento_Magento 1.9 - Fatal编程技术网

Php magento:特定制造商的旧价格的不同格式

Php magento:特定制造商的旧价格的不同格式,php,magento,magento-1.9,Php,Magento,Magento 1.9,如果有特定的制造商(如苹果),我希望有不同的产品旧价格格式 我想我必须在/template/catalog/product/price.html上添加类似的内容,但我敢肯定这是错误的: <?php $manufacturer = Mage::getModel('catalog/product');?> <?php if ($manufacturer && in_array($manufacturer = $product->getAttributeText

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

我想我必须在/template/catalog/product/price.html上添加类似的内容,但我敢肯定这是错误的:

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


假设
manufacturer
是一个产品属性,并且您正在指定的路径中使用一个默认的Magento模板,那么您应该已经在
$\u 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'))) : ?>

非常感谢您的友好回复,这对我帮助很大!