Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Shopping cart empty after canceling external payment provider (like paypal)
 
tzepf
Member
 
Total Posts:  32
Joined:  2011-04-13
 

this issue is not fixed in 1.5.1.

with the solution of nijhof the cart isn´t emptied out, but if i cancel one payment after redirect and select another i have two orders in my backend…

this is really weird…

tobias

 
Magento Community Magento Community
Magento Community
Magento Community
 
TravelSize_ie
Member
 
Total Posts:  39
Joined:  2009-10-19
 

I’ve had some problems with Google Analytics not correctly registering the e-commerce value of orders.
I tracked it down to order details within the quote not being stored properly, and ultimately found it was something I’d done in OnepageController.php.
I’m not sure - I’ve made a couple of other changes too - but it may be related to the “Nijhof method” changes.
So if anyone else has a problem with GA not recording order value, revert those changes and see if it works.

[edit]
Completely my fault, I’d mucked up a line in the successAction, nothing to do with the Nijhof changes

 
Magento Community Magento Community
Magento Community
Magento Community
 
meander1
Jr. Member
 
Total Posts:  11
Joined:  2011-09-07
 

I still have the issue in Magento 1.5.1.0. I tried all solution in this thread but no one works for me. Does anybody get it fixed?

 
Magento Community Magento Community
Magento Community
Magento Community
 
meander1
Jr. Member
 
Total Posts:  11
Joined:  2011-09-07
 

I have the same issue with PayPal, after canceling the oder on PayPal Page the shopping cart is empty.
I also use the payment provider sofortüberweisung.de witth this Magento modul:
http://www.magentocommerce.com/magento-connect/sofortuberweisung.html
They fixed the problem in the new beta version, it may helps fixing the problem.
I’m still looking for a working PayPal modul, can somebody help?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Esurfi
Jr. Member
 
Total Posts:  12
Joined:  2010-01-06
 

Hi meander,

did you find a solution? I have the same problem.

BR, dan

 
Magento Community Magento Community
Magento Community
Magento Community
 
olliebells
Jr. Member
 
Total Posts:  16
Joined:  2009-05-05
 

Hello,

Anybody have a solution for this with 1.6.1.0 at all ?

Having the same issues with Paypal Express and Moneybookers ..

Thanks

 
Magento Community Magento Community
Magento Community
Magento Community
 
matiasb
Jr. Member
 
Avatar
Total Posts:  9
Joined:  2011-12-05
Argentina
 

I stuck a few days with this, so I want to share my solution because none on this topic solved my situation.
Thanks the user Nijhof Internet Media because I relied on your solution.

This is for: GoMage LightCheckout 3.0 (One Step Checkout) & Magento 1.6.1.0

You need to edit the file: app/code/local/GoMage/Checkout/controllers/OnepageController.php

1) Comment the line 1182

Before:

$this->getOnepage()->getQuote()->save();

After:

//$this->getOnepage()->getQuote()->save();

2) Down close, search some code about redirect, and add this line

$this->getOnepage()->getQuote()->save();

Before:

if($redirect){
    $result[
'redirect'$redirect;
}else{
    $result[
'redirect'Mage::getUrl('checkout/onepage/success');                                                            
}

After:

if ($redirect{
    $result[
'redirect'$redirect;
else {
    $this
->getOnepage()->getQuote()->save();
    
$result['redirect'Mage::getUrl('checkout/onepage/success');
}

That’s all.

 
Magento Community Magento Community
Magento Community
Magento Community
 
aravi_iitk
Jr. Member
 
Total Posts:  3
Joined:  2011-10-06
 

In Checkout/Session Model object, quote_id is set to null for guest user, which makes the quote_id for checkout/session to be null. You require to set the quote_id NOT going to null for guest users. You do not require to do anything at success action on payment as it clears the session for the session quote_id/

 
Magento Community Magento Community
Magento Community
Magento Community
 
bbieri
Jr. Member
 
Total Posts:  4
Joined:  2011-09-11
 
terici - 20 August 2011 12:23 AM

//$this->getOnepage()->getQuote()->save(); 
/** 
* when there is redirect to third party, we don’t want to save order yet. 
* we will save the order in return action. 
*/ 
if (isset($redirectUrl)) 
$result[’redirect’] 
$redirectUrl

else 
$this
->getOnepage()->getQuote()->save(); 
}

I had tried this solution on magento 1.5.1 and 1.6 , it’s working fine on GUEST checkout or RETURN CUSTOMER that login on the checkout page, but it’s not working for NEW USER that register on the one page checkout.

After having a deep look into this issue, I find that the problem come from (/app/code/core/Mage/Checkout/Model/Type/Onepage.php) :

protected function _involveNewCustomer()
{
/*--------------*/

$this->getCustomerSession()->loginById($customer->getId());

/*--------------*/
}

After this line, the customer become login, but his cart is empty.

I still don’t know how to fix this issue?

Any help will be very welcome....

BUMP for the love of everything you love. I need an answer to this…

 
Magento Community Magento Community
Magento Community
Magento Community
 
bbieri
Jr. Member
 
Total Posts:  4
Joined:  2011-09-11
 

If you want something done, do it yourself....

First, terici’s post drove me in a wrong direction. I was like “omg need to extend OnepageController AND Onepage model ?? Duuuh so dirty”.
Then I figured out that the only need was to keep the Quote object ACTIVE. This is not about saving it or not !
Keeping this in mind I could enhance Nijhof’s workaround this way :

//$this->getOnepage()->getQuote()->save(); Here is the trick, save() is called few lines lower
        /**
         * when there is redirect to third party, we don't want to save order yet.
         * we will save the order in return action.
         */
        if (isset($redirectUrl)) {
            $result[
'redirect'$redirectUrl;
            
$this->getOnepage()->getQuote()->setIsActive(1) ; // Keep it active if it's a 3rd party payment !
        
}
        $this
->getOnepage()->getQuote()->save();

Of course I saved the core integrity by extending the controller. I’m pretty sure you guys know how to do that, or how to google it smile .
And the method was a perfect copy/paste except for the lines you can see above.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Tijgertje
Jr. Member
 
Total Posts:  3
Joined:  2008-03-31
 

Ok guys....

I’m working with 1.5.0.1

And it doens’t matter which payment method I use. When I cancel the payment, the cart is empthy.

I tried all the solutions above, but nothing worked for me.

When I use the nijhoff solution, I get an error message:

Parse error: syntax error, unexpected T_PROTECTED in /magento/app/code/core/Mage/Checkout/controllers/OnepageController.php on line 519

And there is the following code:

protected function _filterPostData($data)
    
{
        $data 
$this->_filterDates($data, array('dob'));
        return 
$data;
    
}

Does anyone have an idear?

Oh… I don’t use Ogone. I Use Sisow and Paypal.

 
Magento Community Magento Community
Magento Community
Magento Community
 
bbieri
Jr. Member
 
Total Posts:  4
Joined:  2011-09-11
 
Tijgertje - 26 April 2012 01:10 AM

Parse error: syntax error, unexpected T_PROTECTED

This is not a “solution not working”. It’s a php syntax mistake. Check your code.

 
Magento Community Magento Community
Magento Community
Magento Community
 
jugosali2
Jr. Member
 
Total Posts:  1
Joined:  2011-02-03
 
matiasb - 05 December 2011 03:08 PM

I stuck a few days with this, so I want to share my solution because none on this topic solved my situation.
Thanks the user Nijhof Internet Media because I relied on your solution.

This is for: GoMage LightCheckout 3.0 (One Step Checkout) & Magento 1.6.1.0

You need to edit the file: app/code/local/GoMage/Checkout/controllers/OnepageController.php

1) Comment the line 1182

Before:

$this->getOnepage()->getQuote()->save();

After:
//$this->getOnepage()->getQuote()->save();

2) Down close, search some code about redirect, and add this line

$this->getOnepage()->getQuote()->save();

Before:
if($redirect){
    $result[
'redirect'$redirect;
}else{
    $result[
'redirect'Mage::getUrl('checkout/onepage/success');                                                            
}

After:
if ($redirect{
    $result[
'redirect'$redirect;
else {
    $this
->getOnepage()->getQuote()->save();
    
$result['redirect'Mage::getUrl('checkout/onepage/success');
}

That’s all.

That worked for me with version 2.4.

Thanks a lot

 
Magento Community Magento Community
Magento Community
Magento Community
 
realfabrica
Jr. Member
 
Avatar
Total Posts:  5
Joined:  2011-12-17
Madrid, Spain
 

It’s my first drive around Magento.
We have a Magento CE 1.7.0.2.
I copied OnePageController.php to local and changed from line 555 as you did… but nothing happens. :(

bbieri - 16 March 2012 06:22 AM

If you want something done, do it yourself....

First, terici’s post drove me in a wrong direction. I was like “omg need to extend OnepageController AND Onepage model ?? Duuuh so dirty”.
Then I figured out that the only need was to keep the Quote object ACTIVE. This is not about saving it or not !
Keeping this in mind I could enhance Nijhof’s workaround this way :

//$this->getOnepage()->getQuote()->save(); Here is the trick, save() is called few lines lower
        /**
         * when there is redirect to third party, we don't want to save order yet.
         * we will save the order in return action.
         */
        if (isset($redirectUrl)) {
            $result[
'redirect'$redirectUrl;
            
$this->getOnepage()->getQuote()->setIsActive(1) ; // Keep it active if it's a 3rd party payment !
        
}
        $this
->getOnepage()->getQuote()->save();

Of course I saved the core integrity by extending the controller. I’m pretty sure you guys know how to do that, or how to google it smile .
And the method was a perfect copy/paste except for the lines you can see above.
 
Magento Community Magento Community
Magento Community
Magento Community
 
Rakesh Dsouza
Jr. Member
 
Total Posts:  21
Joined:  2011-01-09
 
Nijhof Internet Media - 12 August 2010 09:52 AM

You’re right, Timpea.
The reason I thought it was fixed was because I use OneStepCheckout extension.

I did some tests with the native Onepage checkout and unfortunately it turns out that the problem is still there: the onepage checkout is always emptying the card nomatter it is an external payment gateway or not.
And yes, like you said, changing app/code/core/Mage/Sales/Model/Service/Quote.php is not a good idea…

But the good news is that I think I got it fixed. (only tested with Magento version 1.4.1.1)
Just make the following change (better to make a local copy) in file: app/code/core/Mage/Checkout/controllers/OnepageController.php
line 484 - 491 ORIGINAL:

$this->getOnepage()->getQuote()->save();
        
/**
         * when there is redirect to third party, we don't want to save order yet.
         * we will save the order in return action.
         */
        
if (isset($redirectUrl)) {
            $result[
'redirect'$redirectUrl;
        
}

CHANGE TO
//$this->getOnepage()->getQuote()->save();
        /**
         * when there is redirect to third party, we don't want to save order yet.
         * we will save the order in return action.
         */
        if (isset($redirectUrl)) {
            $result[
'redirect'$redirectUrl;
        
}
        
else {
            $this
->getOnepage()->getQuote()->save();
        
}

As you can see, in the original code the quote is always saved (this was modified in version 1.4.1.0, before that this was not the case) thus emptying the cart.
But we don’t want that to happen if there is a redirect to an external payment method.

I tested this with checkout as Guest and the following payment methods:
- native check / money order: cart is emptied (=ok)
- native PayPal, transaction OK: cart is emptied (=ok)
- native PayPal, transaction Cancelled: cart is NOT emptied (=ok)
- third party PSP module (dutch multisafepay): transaction OK: cart is emptied (=ok)
- third party PSP module (dutch multisafepay): transaction Cancelled: cart is NOT emptied (=ok)

I didn’t test it yet with a logged in account or “make account” but I guess this will be ok too.

Please let e know if this works for you too.

have done the changes in version 1.5.1… and tested it it works waiting customers feedback regarding the same… will let you know if this works finally.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top