1
希望根據管理員可管理的百分比計算運費。
對於E.g: - 運費[ADMIN]:10
如果小計= 100
然後 運費= 10。
預先感謝。magento收費運費佔小計的百分比
希望根據管理員可管理的百分比計算運費。
對於E.g: - 運費[ADMIN]:10
如果小計= 100
然後 運費= 10。
預先感謝。magento收費運費佔小計的百分比
唉,得到了答案。從應用程序/代碼/核心/法師/運輸/型號/電信/ Flatrate.php到
文件副本 - >本地/法師/運輸/型號/電信/ Flatrate.php
關於線96編輯相應:
if ($request->getFreeShipping() === true || $request->getPackageQty() == $this->getFreeBoxes()) {
$shippingPrice = '0.00';
}
//code starts here
if ($this->getConfigData('shipper_type') == 'P')
{
$session = Mage::getSingleton('checkout/session');
$quote_id = $session->getQuoteId();
$item_quote = Mage::getModel('sales/quote')->load($quote_id);
$shippingPrice = $item_quote->getSubtotal()*($this->getConfigData('price')/100);
//code ends here
}
$method->setPrice($shippingPrice);
$method->setCost($shippingPrice);
在應用程序/代碼/核心/法師/運輸的/ etc /的system.xml。 [關於路線:181]
<shipper_type translate="label">
<label>Calculate Shipping Fee</label>
<frontend_type>select</frontend_type>
<source_model>shipping/source_shipperType</source_model>
<sort_order>4</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>0</show_in_store>
</shipper_type>
創建在應用程序/代碼/核心/法師/運輸/型號/來源/ ShipperType.php
class Mage_Shipping_Model_Source_ShipperType
{
public function toOptionArray()
{
return array(
array('value' => Mage_Shipping_Model_Carrier_Abstract::HANDLING_TYPE_FIXED, 'label' => Mage::helper('shipping')->__('Fixed')),
array('value' => Mage_Shipping_Model_Carrier_Abstract::HANDLING_TYPE_PERCENT, 'label' => Mage::helper('shipping')->__('Percent')),
);
}
}
我希望這可以幫助別人。
我覺得system.xml部分是錯誤的,它應該引用shipperType,而不是handlingType。除此之外,這是一個巨大的幫助。 – iJeep 2013-05-02 18:52:57
@iJeep:謝謝。指出它。那麼system.xml現在已經更新了。 – 2013-05-03 05:44:03
請避免更改核心文件,更好的方法是按照本教程的建議操作:http://www.smashingmagazine.com/2014/01/15/create-custom-shipping-methods-magento/ – 2014-11-13 16:26:35