将变量与字符串进行比较时创建异常?

时间:2014-10-06 14:39:36

标签: php magento

下面的PHP代码摘录触发"征集价格"适用于我们Magento网站上的精选制造商。那么,我如何排除"从这些供应商中选择产品?例如,在我们的制造商" XMarks"有10种我不想展示的产品"征集价格"而是销售价格,清单价格和添加到购物车按钮。我该怎么做呢?我是一个完整的初学者。谢谢!

<p class="special-price">
<span class="price-label"><?php echo $this->__('Special Price:') ?></span>
<span class="price" id="product-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>">
<?php if($manufacturerName == 'XMarks' || $manufacturerName == 'Maxtor' || $manufacturerName == 'Trixfx' || $manufacturerName == "Oouph" || $manufacturerName == "Groffer" || $manufacturerName == "Wofstern"){ ?>
<span class="olyprice">Call for Price</span><?php }

1 个答案:

答案 0 :(得分:0)

<p class="special-price">
<span class="price-label"><?php echo $this->__('Special Price:') ?></span>
<span class="price" id="product-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>">
<?php 
function callPrice(){ echo '<span class="olyprice">Call for Price</span>';}

switch ($manufacturerName){
       case: 'XMarks'
        if(product != prduct)
        {
           callPrice();
        }
        break;
       case: 'Maxtor'
        if(product != prduct)
        {
          callPrice();
        }
        break;
    ...