Php Magento配送方法费率返回空值
我在Magento中创建了一个新的发货方法,用于Onepage签出。该方法出现在前端并已定义,但是每当尝试检索速率时,它都返回NULL。特别是在Php Magento配送方法费率返回空值,php,xml,magento,shipping,Php,Xml,Magento,Shipping,我在Magento中创建了一个新的发货方法,用于Onepage签出。该方法出现在前端并已定义,但是每当尝试检索速率时,它都返回NULL。特别是在Mage/Sales/Model/Quote.php中,$method返回我的方法,但$rate=null 模块: protected $_code = 'module_shipping'; public function collectRates(Mage_Shipping_Model_Rate_Request $request) { $re
Mage/Sales/Model/Quote.php
中,$method
返回我的方法,但$rate=null
模块:
protected $_code = 'module_shipping';
public function collectRates(Mage_Shipping_Model_Rate_Request $request)
{
$result = Mage::getModel('shipping/rate_result');
$result->append($this->_getMyShippingShippingRate());
return $result;
}
protected function _getMyShippingShippingRate()
{
$rate = Mage::getModel('shipping/rate_result_method');
$rate->setCarrier($this->_code);
$rate->setCarrierTitle($this->getConfigData('title'));
$rate->setMethod('my_ship_fn');
$rate->setMethodTitle('A New Method');
$rate->setPrice(0);
$rate->setCost(0);
return $rate;
}
public function getAllowedMethods()
{
return array(
'my_ship_fn' => 'A New Method',
);
}
Config.xml
<default>
<carriers>
<module_shipping>
<active>1</active>
<model>company_retailshipping/carrier_myshippingfn</model>
<title>A New Method</title>
<sort_order>10</sort_order>
<sallowspecific>0</sallowspecific>
</module_shipping>
</carriers>
</default>
1.
公司\零售运输/承运人\我的托运fn
一种新方法
10
0
请详细说明“它返回NULL。特别是在Mage/Sales/Model/Quote.php中,$method返回我的方法,但$rate=NULL。”——也许可以给出一些类/行号以供参考。您的代码看起来是正确的,如果它出现在前端,那么应该是正确的。我可能猜是别的什么东西,可能是另一个模块,正在干扰。请检查它