将免费送货标签添加到价格超过一定金额的magento产品页面


Add free shipping label to magento product pages with price over a certain amount?

我想在我的Magento产品页面上的某个地方添加一个"免费送货"标签。该代码非常简单:

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

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

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

感谢您的帮助(顺便说一下,我在Magento v1.6.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; ?>

希望它会有所帮助。