Magento News

 

Return from Paypal causes order cancellation

by nigelt (Posted Sun, 13 Feb 2011 11:14:32 GMT)
Hmm.. I replied to this ages ago but god knows where the post has gone !
Here it is again for paypal….

The file that need altering is…..

/app/code/core/Mage/Paypal/controllers/StandardController.php

Replace the following code.
Its a workaround. It returns to magento, and keeps the cart active, but no information on whats happened !

public function cancelAction()
{
$session = Mage::getSingleton(‘checkout/session’);
$session->setQuoteId($session->getPaypalStandardQuoteId(true));

// Diglin – Allow to the user to get back his cart

Mage::getModel(‘sales/quote’)->load($session->getQuoteId())->setIsActive(true)->save();

if ($session->getLastRealOrderId()) {
$order = Mage::getModel(‘sales/order’)->loadByIncrementId($session->getLastRealOrderId());
if ($order->getId()) {
$order->cancel()->save();
}
}

$this->_redirect(‘checkout/cart’);

I think diglin was the originator of this code, so thankyou diglin.
I’ve used this in 1.4.2 and its fine, havent tried on 1.5.0 yet though.

Nige



http://magento-forum.co.uk/viewtopic.php?f=3&t=619#p2303

Magento Forum

Possibly Related Posts:


 

Leave a Reply