13144 - fix double click bug when validating bankwire and cheque payment (causes 2 orders to be created)

This commit is contained in:
Rodney Figaro 2017-05-29 16:17:47 +02:00
parent b3e4001f3b
commit e33755356c
2 changed files with 33 additions and 3 deletions

View File

@ -17,7 +17,7 @@
{l s='Your shopping cart is empty.' mod='bankwire'}
</p>
{else}
<form action="{$link->getModuleLink('bankwire', 'validation', [], true)|escape:'html':'UTF-8'}" method="post">
<form action="{$link->getModuleLink('bankwire', 'validation', [], true)|escape:'html':'UTF-8'}" method="post" id='payment_validation'>
<div class="box cheque-box">
<div class="shadow"></div>
<div class="inner">
@ -79,3 +79,18 @@
</div>
</section>
</main>
{literal}
<script language='javascript'>
$(document).ready(function()
{
// Prevent for double submission (eg. when double-clicking...)
$('#payment_validation').submit(function(e){
if (this.is_submitted) {
e.preventDefault();
}
this.is_submitted = true;
});
});
</script>
{/literal}

View File

@ -18,7 +18,7 @@
<div class="shadow"></div>
<div class="inner">
<h2 class="title">{l s='Check payment' mod='cheque'}</h2>
<form action="{$link->getModuleLink('cheque', 'validation', [], true)|escape:'html'}" method="post">
<form action="{$link->getModuleLink('cheque', 'validation', [], true)|escape:'html'}" method="post" id="payment_validation">
<p>
<strong>{l s='You have chosen to pay by check.' mod='cheque'}</strong>
{l s='Here is a short summary of your order:' mod='cheque'}
@ -71,3 +71,18 @@
</div>
</section>
</main>
{literal}
<script language='javascript'>
$(document).ready(function()
{
// Prevent for double submission (eg. when double-clicking...)
$('#payment_validation').submit(function(e){
if (this.is_submitted) {
e.preventDefault();
}
this.is_submitted = true;
});
});
</script>
{/literal}