0
在collectRates方法shippingModule,我已經建立了幾個值:的Magento得到航運collectRates()屬性在觀察者
$method->setCarrier('test_customrate');
$method->setCarrierTitle($this->getConfigData('title'));
$method->setMethod('test_customrate');
$method->setMethodTitle($this->getConfigData('name'));
$method->setPrice($this->getConfigData('price'));
$method->setCost(2);
$method->setUsername($this->getConfigData('username'));
$method->setPassword($this->getConfigData('password'));
$result->append($method);
當存儲在結賬會話這些價值? 我無法在任何地方找到它們。
我現在已經發現,在觀察者的下面提到的代碼中,我可以得到如上所述的一些值。但是,有些值,如成本,用戶名和密碼不在這裏。
$rates = Mage::getSingleton('checkout/session')->getQuote()->getShippingAddress()
->getShippingRatesCollection();
foreach ($rates as $rate) {
Mage::log($rate->getData());
}
這個檢索以下結構的東西:
2013-06-01T15:36:10+00:00 DEBUG (7): Array
(
[rate_id] => 852
[address_id] => 93
[created_at] => 2013-06-01 15:36:06
[updated_at] => 2013-06-01 15:36:09
[carrier] => test_customrate
[carrier_title] => test_customrate
[code] => test_customrate_test_customrate
[method] => test_customrate
[method_description] =>
[price] => 0.0000
[method_title] => test123
[error_message] =>
)