Prevent checkout being submitted twice

This commit is contained in:
Mike Jolley 2011-11-16 09:38:04 +00:00
parent 96272f0e48
commit b23338c2b0
4 changed files with 9 additions and 3 deletions

View File

@ -549,7 +549,10 @@ jQuery(document).ready(function($) {
/* AJAX Form Submission */ /* AJAX Form Submission */
$('form.checkout').submit(function(){ $('form.checkout').submit(function(){
var form = this; var form = this;
$(form).block({message: null, overlayCSS: {background: '#fff url(' + woocommerce_params.plugin_url + '/assets/images/ajax-loader.gif) no-repeat center', opacity: 0.6}});
if ($(form).is('.processing')) return false;
$(form).addClass('processing').block({message: null, overlayCSS: {background: '#fff url(' + woocommerce_params.plugin_url + '/assets/images/ajax-loader.gif) no-repeat center', opacity: 0.6}});
$.ajax({ $.ajax({
type: 'POST', type: 'POST',
url: woocommerce_params.checkout_url, url: woocommerce_params.checkout_url,
@ -562,7 +565,7 @@ jQuery(document).ready(function($) {
} }
catch(err) { catch(err) {
$(form).prepend( code ); $(form).prepend( code );
$(form).unblock(); $(form).removeClass('processing').unblock();
$('html, body').animate({ $('html, body').animate({
scrollTop: ($('form.checkout').offset().top - 100) scrollTop: ($('form.checkout').offset().top - 100)

File diff suppressed because one or more lines are too long

View File

@ -98,6 +98,7 @@ Yes you can! Join in on our GitHub repository :) https://github.com/woothemes/wo
* Added logger class for debugging * Added logger class for debugging
* Ability to make layered nav an "OR" query so you can expand your search rather than filter it * Ability to make layered nav an "OR" query so you can expand your search rather than filter it
* Tweaked coupon logic. Excluded coupons (for product discounts) don't get a product discount, but valid products do * Tweaked coupon logic. Excluded coupons (for product discounts) don't get a product discount, but valid products do
* Prevent checkout being submitted twice
= 1.2.1 - 10/11/2011 = = 1.2.1 - 10/11/2011 =
* Reworked downloadable and virtual products - now variations can be downloadable/virtual too making it more flexible * Reworked downloadable and virtual products - now variations can be downloadable/virtual too making it more flexible

View File

@ -151,6 +151,8 @@
</div> </div>
<div class="clear"></div>
</div> </div>
</div> </div>