我有一个客户,他拥有三个航运区: - 英国 - 欧洲 - 世界
每个产品的运输成本将是根据客户落入三个区域之一自动计算的统一费率。这在 Magento 中可能吗?
富有的
创建一个新模块。创建一个继承自Mage_Shipping_Model_Carrier_Abstract
fx的新模型类
class MyCompany_MyModule_Model_Flatrate extends Mage_Shipping_Model_Carrier_Abstract
{
protected $_code = 'mycompany_flatrate'; // some unique shipping code
public function collectRates(Mage_Shipping_Model_Rate_Request $data)
{
if(!$this->isActive())
return false;
/* @var $method Mage_Shipping_Model_Rate_Result_Method */
/* @var $result Mage_Shipping_Model_Rate_Result */
$method = Mage::getModel('shipping/rate_result_method');
$result = Mage::getModel('shipping/rate_result');
$method->setCarrier($this->_code);
$method->setCarrierTitle($this->getConfigData('name'));
$method->setMethod($this->_code);
$method->setMethodTitle($this->getConfigData('name'));
if($data->getDestCountryId() == '...')
$method->setPrice(...);
else if (...)
...
$result->append($method);
return $result;
}
}
并将以下内容添加到您的 config.xml
<default>
<carriers>
<mycompany_flatrate>
<active>1</active>
<model>mycompany_mymodule/flatrate</model>
<name>Flatrate</name>
<title>Flatrate</title>
<sallowspecific>0</sallowspecific>
</mycompany_flatrate>
</carriers>
</default>
<config>
标签下。
您可以尝试 Webshopapps Matrixrate 扩展。它有很多方法可以自定义表格运费。