【问题标题】:Add free shipping label to magento product pages with price over a certain amount?将免费送货标签添加到价格超过一定金额的 magento 产品页面?
【发布时间】:2012-06-22 16:40:45
【问题描述】:

我想在我的 Magento 产品页面的某处添加“免费送货”标签。这段代码很简单:

<?php echo $this->__('FREE SHIPPING') ?>

问题是,我只为价格超过 199 美元的产品提供免费送货服务。

如何设置 if 语句以仅在价格超过 199 美元时显示此标签?

感谢您的帮助(顺便说一下,我正在使用 Magento v1.6.1)

【问题讨论】:

    标签: magento label magento-1.6 php


    【解决方案1】:

    你可以尝试这样做:

    
    // somewhere on product page, e.g. view.phtml
    <?php if ($_product->getPrice() > 199) :
    //if you don't have direct access to $_product variable from your template or to $this->getProduct() method of block template belongs to, try using registry,e.g.
    //if (Mage::registry('current_product')->getPrice() > 199):
        echo $this->__('FREE SHIPPING');
    endif; ?>
    

    希望它会有所帮助。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-12-15
      • 1970-01-01
      • 2012-01-14
      • 2015-12-06
      • 1970-01-01
      相关资源
      最近更新 更多