Magento Forum

Page 2 of 3
Duplicate Orders due to slow redirect
 
DrBillNye
Sr. Member
 
Avatar
Total Posts:  96
Joined:  2009-02-07
Boulder, CO
 
netdude - 28 September 2010 09:38 PM

what kind of hardware do you people use for your setups? I gots me a purdy quad-core w/8GB RAM running my mysql engine+memcached and two small quad-cores VDSes running frontend NGINX+PHP-FPM+APC+MEMCACHE (memcache client lib for distributing the sessions between multiple servers only, because I feel that using db as a method is just too inefficient). One SSL certificate with some crafty URL-rewriting/symlink/[index.php modifications] to work across mutiiple store views.

show off grin

 
Magento Community Magento Community
Magento Community
Magento Community
 
simonlilly
Member
 
Total Posts:  33
Joined:  2008-02-18
 

On my smaller site I’ve switched to Deferred payments as a way of avoiding the duplication issue. It’s not a solution, but it stops our customers getting charged twice.

Unfortunately the switch from Sendmail to Postfix wasn’t applicable to us as we were already using that, but still gettting the duplicate payment issue.

The larger volume site is on v1.4.0.1 and the smaller site is on v1.4.1.1 and both have similar issues.

We’ve added JS on the Submit payment button to stop double-clicks and to also mitigate against customers that refresh whilst the order is processing.

Does anyone know if they’ve released a fix for the Google Checkout duplicate order issue as it might fix all of our duplicate payment issues?

 
Magento Community Magento Community
Magento Community
Magento Community
 
bladesling
Jr. Member
 
Total Posts:  11
Joined:  2009-07-01
 

This is my modification to make sure customers cannot submit the order more than once.

Just edit the area that says temporary code. This is a temporary solution. What this code does is makes the place order button disappear after the first time they click it. Making it so they can’t click it again.

skin/frontend/template/template/js/opcheckout.js

var Review = Class.create();
Review.prototype {
    initialize
: function(saveUrlsuccessUrlagreementsForm){
        this
.saveUrl saveUrl;
        
this.successUrl successUrl;
        
this.agreementsForm agreementsForm;
        
this.onSave this.nextStep.bindAsEventListener(this);
        
this.onComplete this.resetLoadWaiting.bindAsEventListener(this);
    
},

    
save: function(){
        
// Temporary code
        
var container = $('review-buttons-container');
        
container.setStyle({display:'none'});
        
Element.show('review-please-wait');
        
// Temporary Code
        
if (checkout.loadWaiting!=false) return;
        
checkout.setLoadWaiting('review');
        var 
params Form.serialize(payment.form);
        if (
this.agreementsForm{
            params 
+= '&'+Form.serialize(this.agreementsForm);
        
}
        params
.save true;
        var 
request = new Ajax.Request(
            
this.saveUrl,
            
{
                method
:'post',
                
parameters:params,
                
onCompletethis.onComplete,
                
onSuccessthis.onSave,
                
onFailurecheckout.ajaxFailure.bind(checkout)
            
}
        
);
    
},

    
resetLoadWaiting: function(transport){
        checkout
.setLoadWaiting(falsethis.isSuccess);
    
},

    
nextStep: function(transport){
        
if (transport && transport.responseText{
            try{
                response 
eval('(' transport.responseText ')');
            
}
            
catch (e{
                response 
{};
            
}
            
if (response.redirect{
                location
.href response.redirect;
                return;
            
}
            
if (response.success{
                this
.isSuccess true;
                
[removed]=this.successUrl;
            
}
            else{
                
var msg response.error_messages;
                if (
typeof(msg)=='object'{
                    msg 
msg.join("\n");
                
}
                alert(msg)
;
            
}
        }
    }
,

    
isSuccessfalse
}
 
Magento Community Magento Community
Magento Community
Magento Community
 
ramiroraghvan
Jr. Member
 
Total Posts:  5
Joined:  2010-10-01
 

I think Magento runs faster then the server from my payment provider because its takes about 4-10 second to go to their redirect page.

 
Magento Community Magento Community
Magento Community
Magento Community
 
tpboles22
Jr. Member
 
Total Posts:  9
Joined:  2009-11-04
 
bladesling - 30 September 2010 12:18 PM

This is my modification to make sure customers cannot submit the order more than once.

Just edit the area that says temporary code. This is a temporary solution. What this code does is makes the place order button disappear after the first time they click it. Making it so they can’t click it again.

If you use this temp code will it re-enable the checkout button if there is a problem such as didn’t select payment method, ect.?

 
Magento Community Magento Community
Magento Community
Magento Community
 
simonlilly
Member
 
Total Posts:  33
Joined:  2008-02-18
 

We’ve implemented this JavaScript solution, but are still receiving duplicate orders.

The time between the duplicates can vary between 3 and 15 minutes before the orders come through to my Payment Services Provider. In the majority of the instances I am seeing the Order does not appear in Magento as a completed order, but does sometimes appear as an Abandoned Basket.

Any other ideas or solutions to this issue would be welcomed…

 
Magento Community Magento Community
Magento Community
Magento Community
 
lvanstaden
Jr. Member
 
Total Posts:  10
Joined:  2009-01-25
 

Hi

We are having the same issue on our site (released just 2-3 weeks ago)

Having had some feedback from testing, the issue seems to be that customers have no indication that something is actually going on after they click submit payment.

Granted, we don\’t use the onepage checkout (we create one called multipage checkout)

I am also implementing a js/ajax solution on the payment submit.

The submit loads a new block via ajax, and replaces the main content element with a new display of \’payment processing\’.

This (hopefully) will show the customer that something is happening as their click on the button loaded a new page telling them that payment is processing. It also means that a ‘page refresh’ will not try and resubmit the overview form, as browser tend to want to do that.

I will post later if this helped.

What would really help is some ind of progress bar that can update during the payment phase. I attempted a jquery progressbar, but the polling to update the display is a bit much, so I scrapped that part.

-Lucas

 
Magento Community Magento Community
Magento Community
Magento Community
 
anns
Jr. Member
 
Total Posts:  17
Joined:  2009-07-12
 

I had started a similar thread over here:

http://www.magentocommerce.com/boards/viewthread/68777/

And we just tried bladesling’s temporary code fix, but we have not yet done a cron job to clear session variables and logs. Our server doesn’t use either postfix or sendmail so that is no help.

Our client is getting so many of them that they’re thinking of shutting down two Magento stores and going to a hosted solution on something else altogether.

That’s not great for Magento, I had been hoping to upgrade this client to professional or even enterprise, but they’ve soured on the idea altogether.

Ann

 
Magento Community Magento Community
Magento Community
Magento Community
 
simonlilly
Member
 
Total Posts:  33
Joined:  2008-02-18
 

We have come up with a solution that essentially is additional code to check that an identical order with the same order total, customer name and delivery address has not been submitted in the previous 5 minutes. This then rejects the duplicate order and redirects to the first payment successful page.

 
Magento Community Magento Community
Magento Community
Magento Community
 
anns
Jr. Member
 
Total Posts:  17
Joined:  2009-07-12
 

My developer found this link, which documents an issue with Authorize.net timing out on a curl action. There’s a code fix there. Our developer has edited our files and hopefully this solves the issue. Here’s the post she found:

http://www.oscprofessionals.com/blog/magento-payment-gateway-authorize-net/

Ann

 
Magento Community Magento Community
Magento Community
Magento Community
 
simonlilly
Member
 
Total Posts:  33
Joined:  2008-02-18
 

We appear to have solved this on the smaller website by doing the following:

1. Turning off the Guest Checkout facility
2. Increasing the Payment Gateway time out to 120 seconds
3. Removing another site from the server, thus freeing up MySQL resources

I think the timeout and MySQL resources are the key to solving this for anyone experiencing this problem.

 
Magento Community Magento Community
Magento Community
Magento Community
 
nikonratm
Sr. Member
 
Total Posts:  84
Joined:  2009-03-18
 
simonlilly - 06 October 2010 12:26 PM

We have come up with a solution that essentially is additional code to check that an identical order with the same order total, customer name and delivery address has not been submitted in the previous 5 minutes. This then rejects the duplicate order and redirects to the first payment successful page.

Simon, any chance you would be willing to share this code with the community? I am having a similar issue on TWO of my Magento sites at the moment.

Thanks!

 
Magento Community Magento Community
Magento Community
Magento Community
 
Ignas616
Jr. Member
 
Total Posts:  6
Joined:  2009-05-13
 

Well I had the same problems with customers that clicked Place order twice.

Here is my quick fix that I used

1) find opcheckout.js that you use.
(in 1.4 i think its in magento_base/js/varien/opcheckout.js)

2) there find declaration of var Review = Class.create();

3) inside find the existing resetLoadWaiting

and replace it with

resetLoadWaiting: function(transport){
        
$('review-please-wait').style.display 'none';// should hide the spinning thingie and please wait message 
        
setTimeout ( function() {             
            checkout
.setLoadWaiting(falsethis.isSuccess); //enables button after 10 seconds if for some reason page is not switched
        
}.bind(this), 10000 );        
    
},

PS dont forget to clean JS cache in admin smile

 
Magento Community Magento Community
Magento Community
Magento Community
 
imwy2cool
Sr. Member
 
Total Posts:  164
Joined:  2009-05-07
 

This thread http://www.magentocommerce.com/boards/viewthread/113901/P60/ completely solved the duplicate order issue for us. In fact, it has solved MANY timeout issues we were having including product export, product import, indexing, etc.

Magento 1.4 through 1.4.1 has a memory leak (I think that is what it is called). From what I understand it was fixed for the 1.4.2 release.

Change the code referenced in the above link, refresh all caches, sign out and then sign back in and give it a go and you’ll notice a HUGE improvement in many parts of your store. I’ve done it on several stores and they’ve all seen a huge improvement.

Also, make sure to empty your log files now and then. Make sure they don’t get out of hand. Still, simply changing this one line of code helped us more than anything else. We haven’t had a duplicate order through PayPal, Google Checkout or Authorize.net since we implemented this fix. I still give many thanks to member (chiefair) who posted the fix, and to Brian Kieth who found this memory leak!

 
Magento Community Magento Community
Magento Community
Magento Community
 
simonlilly
Member
 
Total Posts:  33
Joined:  2008-02-18
 

Thanks for all the contributions to resolving this issue from people around the Magento Community. Problems in the Checkout that effect the customer experience are the worst possible ones that have a real negative impact on your stores online shopping performance.

I’m just reading the updated performance whitepaper that’s been released and found a section in there, that pretty much explains alot of the issues we’ve all been experiencing:

Checkout Performance Test Results
Prior to Enterprise Edition v1.8, the checkout process contained two large database transactions—one for the customer increment calculation (if a new customer is created during the checkout) and the other to check and decrease the stock items quantity. During heavy traffic times, this could cause delays on the frontend for customers attempting to checkout. Only one checkout at the same time was possible.

The limit of a single concurrent checkout is a massive one, especially for smaller businesses running on hosting that isn’t perfectly tunned.

The whitepaper is well worth a download and read: http://info.magento.com/rs/magentocommerce/images/Magento_PerformanceWhitepaper-EEv1-9.1.pdf

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top
Page 2 of 3