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
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?
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
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/
//$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() { /*--------------*/
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 .
And the method was a perfect copy/paste except for the lines you can see above.
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
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 07: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 .
And the method was a perfect copy/paste except for the lines you can see above.
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.