Created
August 19, 2015 07:33
-
-
Save incrize/153cf8b4a874e03cb833 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/design/themes/responsive/templates/views/checkout/components/payments/payment_methods.tpl b/design/themes/responsive/templates/views/checkout/components/payments/payment_methods.tpl | |
index 04145bd..4b8c7c1 100644 | |
--- a/design/themes/responsive/templates/views/checkout/components/payments/payment_methods.tpl | |
+++ b/design/themes/responsive/templates/views/checkout/components/payments/payment_methods.tpl | |
@@ -13,12 +13,21 @@ | |
<script type="text/javascript"> | |
(function(_, $) { | |
$(_.doc).on('click', '.cm-select-payment', function() { | |
- var self = $(this); | |
+ var self = $(this), | |
+ form = self.parents('form'); | |
- $.ceAjax('request', fn_url('{$url}&payment_id=' + self.val()), { | |
+ form.on('submit.select_payment', function() { | |
+ return false; | |
+ }); | |
+ | |
+ var jqxhr = $.ceAjax('request', fn_url('{$url}&payment_id=' + self.val()), { | |
result_ids: '{$result_ids}', | |
full_render: true | |
}); | |
+ | |
+ jqxhr.always(function() { | |
+ form.off('submit.select_payment'); | |
+ }); | |
}); | |
$(_.doc).ready(function() { | |
diff --git a/js/tygh/core.js b/js/tygh/core.js | |
index ff4d180..ad76e38 100644 | |
--- a/js/tygh/core.js | |
+++ b/js/tygh/core.js | |
@@ -3856,11 +3856,10 @@ var Tygh = { | |
return false; | |
} | |
- if ((form.hasClass('cm-ajax') || clicked_elm.hasClass('cm-ajax')) && !clicked_elm.hasClass('cm-no-ajax')) { | |
- | |
- // set clicked flag | |
- clicked_elm.data('clicked', true); | |
+ // set clicked flag | |
+ clicked_elm.data('clicked', true); | |
+ if ((form.hasClass('cm-ajax') || clicked_elm.hasClass('cm-ajax')) && !clicked_elm.hasClass('cm-no-ajax')) { | |
// clean clicked flag | |
$.ceEvent('one', 'ce.ajaxdone', function() { | |
clicked_elm.data('clicked', false); | |
@@ -3871,6 +3870,12 @@ var Tygh = { | |
// otherwise, send to current | |
if (clicked_elm.hasClass('cm-new-window')) { | |
form.prop('target', '_blank'); | |
+ | |
+ // clean clicked flag | |
+ setTimeout(function() { | |
+ clicked_elm.data('clicked', false); | |
+ }, 1000); | |
+ | |
return true; | |
} else if (clicked_elm.hasClass('cm-parent-window')) { | |
@@ -3924,6 +3929,10 @@ var Tygh = { | |
$.ceDialog('get_last').ceDialog('close'); | |
} | |
+ if (form_result == false) { | |
+ clicked_elm.data('clicked', false); // if form won't be submitted, clear clicked flag | |
+ } | |
+ | |
return form_result; | |
} else if (check_fields_result == false) { |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment