ペイパルからリダイレクトした後、ペイパル エクスプレス チェックアウトを介して取引を行う際に、このエラーが発生しました。
配送方法に誤りがありました。
私はmagento 1.7バージョンを使用しています。
ここにエラーが発生するコードがあります
protected function _beforeToHtml()
{
$methodInstance = $this->_quote->getPayment()->getMethodInstance(); // here i get error
$this->setPaymentMethodTitle($methodInstance->getTitle());
$this->setUpdateOrderSubmitUrl($this->getUrl("{$this->_paypalActionPrefix}/express/updateOrder"));
$this->setUpdateShippingMethodsUrl($this->getUrl("{$this->_paypalActionPrefix}/express/updateShippingMethods"));
$this->setShippingRateRequired(true);
if ($this->_quote->getIsVirtual()) {
$this->setShippingRateRequired(false);
} else {
// prepare shipping rates
$this->_address = $this->_quote->getShippingAddress();
$groups = $this->_address->getGroupedAllShippingRates();
if ($groups && $this->_address) {
$this->setShippingRateGroups($groups);
// determine current selected code & name
foreach ($groups as $code => $rates) {
foreach ($rates as $rate) {
if ($this->_address->getShippingMethod() == $rate->getCode()) {
$this->_currentShippingRate = $rate;
break(2);
}
}
}
}
// misc shipping parameters
$this->setShippingMethodSubmitUrl($this->getUrl("{$this->_paypalActionPrefix}/express/saveShippingMethod"))
->setCanEditShippingAddress($this->_quote->getMayEditShippingAddress())
->setCanEditShippingMethod($this->_quote->getMayEditShippingMethod())
;
}
$this->setEditUrl($this->getUrl("{$this->_paypalActionPrefix}/express/edit"))
->setPlaceOrderUrl($this->getUrl("{$this->_paypalActionPrefix}/express/placeOrder"));
return parent::_beforeToHtml();
}