2013-09-25 66 views
0

我想显示freeshipping价格作为文本,如“免费送货”,但我不能得到它的工作。在应用程序/代码/核心/法师/运输/型号/电信/ Freeshipping.php我发现这几行:magento显示免费送货文本

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

但是,如果我改变0.00为“免运费”,没有任何反应。 我在互联网上做了大量的研究,但没有任何工作。还有很多插件可以将价格设置为“免费”,但仅限于产品。

所以我很绝望,我希望有人能帮助我。 我使用的是Magento 1.7.0.2。

非常感谢

回答

1
  1. 复制app/design/frontend/base/default/template/checkout/onepage/shipping_method/available.phtml您正在使用相应的主题文件夹。

  2. available.phtml文件,查找下面的代码(约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. 用以下内容替换它:

    <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. 保存available.phtml,并清除你的Magento缓存。 “免费送货”现在将出现在One-Page-Checkout送货部分包含$ 0金额的所有方法旁边。

+0

这对结帐页面非常有用,谢谢! 但是,如果我使用估算的运费和税款框计算出货价格,那么它仍然显示0.00。那么我应该编辑哪个文件来为那个盒子做同样的事情?再次感谢! –

+0

计算出货块的文件是'app/design/frontend/[theme_path]/template/checkout/cart/shipping.phtml'。为了将来的参考,您可以通过在Magento配置中启用“模板路径提示”来确定在前端加载的确切模板路径。你可以在这里找到一个关于如何做到这一点的快速教程:https://support.sweettoothrewards.com/entries/21255937-How-do-I-turn-on-template-path-hints- – Axel

+0

你是一个伟大的帮手!非常感谢 –