2015-08-21 47 views
0

我們使用兩種運送選項。如果低於50美元,則會增加4.95美元,超過50美元時免運費。當購物車總額超過50美元時,Magento也只使用4.95美元。如何將免費送貨方式設置爲默認?Magento - 作爲默認選項免費送貨

您可以看到,我們的模板中也沒有選項可選擇送貨方式。

magento cart

+0

通過管理員,你可以嘗試編輯設置運輸方式的位置。 –

+0

我認爲這對我有幫助:http://magento.stackexchange.com/questions/17806/free-shipping-if-subtotal-greater-than-or-equal-50但我不確定它是否是最佳選擇。 – Simon

回答

1

爲此,您需要啓用從管理面板兩家航運公司的方法。

  1. 啓用免費送貨和設置最小訂單金額爲$ 50
  2. 啓用扁平率送貨方式,並設置價格至4.95

通過這種方式固定費率的送貨方式在結賬和免費送貨始終可見方法來當訂單金額最低$ 50。

當免費送貨方式啓用時,我們需要刪除統一運費方式。爲此,您需要遵循以下流程:

複製Flatrate Carrier ModelCore池到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; 
    }  
1

在管理設置你的送貨方法速率爲默認值4.95,並在您的運輸模型(例如Mage_Shipping_Model_Carrier_Flatrate)方法collectRates,添加一個條件,以檢查車總:

if ($request->getBaseSubtotalInclTax() >= 50) 
{ 
    $method->setPrice(0.00); 
    $method->setCost(0.00); 
    $method->setCarrierTitle('Free Shipping'); 
}