想要根据管理员可以管理的百分比来计算运费
例如: - 运费[ADMIN] :10
如果小计= 100.
然后
运费= 10.
提前谢谢。
答案 0 :(得分:3)
Alas得到了答案
文件从 app / code / core / Mage / Shipping / Model / Carrier / 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);
在 app / code / core / Mage / Shipping / etc / system.xml。 [关于line: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>
创建在app / code / core / mage / Shipping / Model / Source / 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')),
);
}
}
我希望这有助于某人。