doushi3202 2012-06-22 16:40
浏览 22
已采纳

在magento产品页面上添加免费送货标签,价格超过一定金额?

I would like to add a "Free Shipping" label somewhere on my Magento product pages. That code is pretty simple:

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

The problem is, I only offer free shipping on products costing over $199.

How can I set up an if statement to only display this label if price is over $199?

Thanks for your help (I'm on Magento v1.6.1 by the way)

  • 写回答

1条回答 默认 最新

  • doujia8801 2012-06-22 21:11
    关注

    You can try do something like this:

    
    // 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; ?>
    

    Hope it will help.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 Android Studio中如何把H5逻辑放在Assets 文件夹中以实现将h5代码打包为apk
  • ¥15 使用小程序wx.createWebAudioContext()开发节拍器
  • ¥15 关于#爬虫#的问题:请问HMDB代谢物爬虫的那个工具可以提供一下吗
  • ¥15 vue3+electron打包获取本地视频属性,文件夹里面有ffprobe.exe 文件还会报错这是什么原因呢?
  • ¥20 用51单片机控制急停。
  • ¥15 孟德尔随机化结果不一致
  • ¥15 在使用pyecharts时出现问题
  • ¥15 深度学习残差模块模型
  • ¥50 怎么判断同步时序逻辑电路和异步时序逻辑电路
  • ¥15 差动电流二次谐波的含量Matlab计算