doyhq66282 2013-09-25 21:48
浏览 14
已采纳

magento显示免费送货文本

I want to show the freeshipping price as text, like "Free shipping" but I can't get it to work. In app/code/core/Mage/Shipping/Model/Carrier/Freeshipping.php I found these lines:

$method->setPrice('0.00');
$method->setCost('0.00');

But if I change the 0.00 to "Free shipping", nothing happens. I did a LOT of research on the internet but nothing works. There are also much plugins that can set the price to "Free" but that only counts for the products.

So I am desperate and I hope someone can help me here. I am using Magento 1.7.0.2.

Many thanks

  • 写回答

1条回答 默认 最新

  • dongzhi6146 2013-09-25 22:27
    关注
    1. Copy app/design/frontend/base/default/template/checkout/onepage/shipping_method/available.phtml to the respective theme folder you are using.

    2. In the available.phtml file, look for the following code (around line 56):

      <label for="s_method_<?php echo $_rate->getCode() ?>"><?php echo $_rate->getMethodTitle() ?>
      <?php $_excl = $this->getShippingPrice($_rate->getPrice(), $this->helper('tax')->displayShippingPriceIncludingTax()); ?>
      <?php $_incl = $this->getShippingPrice($_rate->getPrice(), true); ?>
      <?php echo $_excl; ?>
      <?php if ($this->helper('tax')->displayShippingBothPrices() && $_incl != $_excl): ?>
          (<?php echo $this->__('Incl. Tax'); ?> <?php echo $_incl; ?>)
      <?php endif; ?>
      </label>
      
    3. Replace it with the following:

      <label for="s_method_<?php echo $_rate->getCode() ?>"><?php echo $_rate->getMethodTitle() ?>
      <?php if($_rate->getPrice() > 0) : ?>        
      <?php $_excl = $this->getShippingPrice($_rate->getPrice(), $this->helper('tax')->displayShippingPriceIncludingTax()); ?>
      <?php $_incl = $this->getShippingPrice($_rate->getPrice(), true); ?>
      <?php echo $_excl; ?>
      <?php if ($this->helper('tax')->displayShippingBothPrices() && $_incl != $_excl): ?>
          (<?php echo $this->__('Incl. Tax'); ?> <?php echo $_incl; ?>)
      <?php endif; ?>
      <?php else : ?>
            (<?php echo $this->__('Free Shipping'); ?>)
      <?php endif; ?>
      </label>
      
    4. Save available.phtml, and clear your Magento caches. "Free Shipping" will now appear next to all methods containing a $0 amount on the One-Page-Checkout shipping section.

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

报告相同问题?

悬赏问题

  • ¥15 TLS1.2协议通信解密
  • ¥40 图书信息管理系统程序编写
  • ¥20 Qcustomplot缩小曲线形状问题
  • ¥15 企业资源规划ERP沙盘模拟
  • ¥15 树莓派控制机械臂传输命令报错,显示摄像头不存在
  • ¥15 前端echarts坐标轴问题
  • ¥15 ad5933的I2C
  • ¥15 请问RTX4060的笔记本电脑可以训练yolov5模型吗?
  • ¥15 数学建模求思路及代码
  • ¥50 silvaco GaN HEMT有栅极场板的击穿电压仿真问题