【问题标题】:Magento - Free shipping as default optionMagento - 免费送货作为默认选项
【发布时间】:2015-11-15 03:01:43
【问题描述】:
我们使用两种运输方式。如果低于 50 美元,则添加 4.95 美元,超过 50 美元时免费送货。当购物车总金额超过 50 美元时,Magento 也仅使用 4.95 美元。如何设置默认包邮方式?
如您所见,我们的模板中也没有选择运输方式的选项。
【问题讨论】:
标签:
magento
methods
default
shipping
【解决方案1】:
为此,您需要从管理面板启用两种送货方式。
- 启用免费送货并将最低订单金额设置为 50 美元
- 启用统一运费方式并将价格设置为 4.95
通过这种方式,结帐时始终可以看到统一费率送货方式,而当订单金额至少为 50 美元时,则提供免费送货方式。
当启用免费送货方式时,我们需要删除统一费率送货方式。为此,您需要遵循以下流程:
将Flatrate Carrier Model 从Core 池复制到local 池。
发件人: app/code/core/Mage/Shipping/Model/Carrier/Flatrate.php
收件人: app/code/local/Mage/Shipping/Model/Carrier/Flatrate.php
在collectRates 函数中添加以下行:
if ($request->getBaseSubtotalInclTax() >= Mage::getStoreConfig('carriers/freeshipping/free_shipping_subtotal')) {
return false;
}
在这几行之后:
if (!$this->getConfigFlag('active')) {
return false;
}
【解决方案2】:
在管理员中将您的运输方式费率设置为默认 4.95,并在您的运输模型(例如 Mage_Shipping_Model_Carrier_Flatrate)方法 collectRates 中,添加一个条件来检查购物车总数:
if ($request->getBaseSubtotalInclTax() >= 50)
{
$method->setPrice(0.00);
$method->setCost(0.00);
$method->setCarrierTitle('Free Shipping');
}