Magento-取消运输和使用免费送货时的处理 [英] Magento - remove shipping & handling when using Freeshipping
问题描述
我有以下问题:我必须采用主要的送货方式.第一个为200美元以下的订单收取10美元的运输费.第二种方法是默认免费送货,适用于订单金额超过200美元的商品.
I have the following issue: I have to main shipping methods. The first one charges a $10 shipping fee for orders below $200. The second method is the default freeshipping, which applies for orders over $200.
应用免费送货后,运费和处理小计显示0.00,但我不希望此行不会在结帐或发票中显示.
When freeshipping is applied, the Shipping & Handling subtotal displays 0.00, and I don't want this line to show up neither in the checkout nor in the invoice.
有什么办法可以消除运输和运输费用吗?使用免费送货时完全处理生产线吗?
Is there any way to remove the shipping & handling line completely when freeshipping is used?
预先感谢您的任何想法.
Thanks in advance for any thoughts.
推荐答案
我不喜欢通过代码过滤此类内容.所以我想出了一个覆盖Mage_Sales_Model_Quote_Address_Total_Shipping :: fetch(Mage_Sales_Model_Quote_Address $ address)的解决方案
I dislike filtering things like this by code. So I came up with a solution overriding Mage_Sales_Model_Quote_Address_Total_Shipping::fetch(Mage_Sales_Model_Quote_Address $address)
app/code/local/Me/MyModule/Model/Sales/Quote/Address/Total/Shipping.php:
app/code/local/Me/MyModule/Model/Sales/Quote/Address/Total/Shipping.php:
<?php
class Me_MyModule_Model_Sales_Quote_Address_Total_Shipping
extends Mage_Sales_Model_Quote_Address_Total_Shipping
{
/**
* Add shipping totals information to address object
*
* @param Mage_Sales_Model_Quote_Address $address
* @return Mage_Sales_Model_Quote_Address_Total_Shipping
*/
public function fetch(Mage_Sales_Model_Quote_Address $address)
{
if ($address->getShippingAmount() == 0) {
return $this;
}
return parent::fetch($address);
}
}
app/code/local/Me/MyModule/etc/config.xml:
app/code/local/Me/MyModule/etc/config.xml:
<?xml version="1.0"?>
<config>
<modules>
<Me_MyModule>
<version>0.0.1</version>
</Me_MyModule>
</modules>
<global>
<models>
<me_mymodule>
<class>Me_MyModule_Model</class>
</me_mymodule>
<sales>
<rewrite>
<quote_address_total_shipping>Me_MyModule_Model_Sales_Quote_Address_Total_Shipping</quote_address_total_shipping>
</rewrite>
</sales>
</models>
</global>
</config>
app/etc/modules/Me_MyModule.xml:
app/etc/modules/Me_MyModule.xml:
<?xml version="1.0" encoding="UTF-8"?>
<config>
<modules>
<Me_MyModule>
<active>true</active>
<codePool>local</codePool>
</Me_MyModule>
</modules>
</config>
这篇关于Magento-取消运输和使用免费送货时的处理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!