Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

Disable the order submit button

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #1  
Old 02-19-2004, 02:14 PM
 
dsparks dsparks is offline
 

Advanced Member
  
Join Date: Nov 2002
Posts: 34
 

Default Disable the order submit button

There was a piece of code on the forum before the site went down that explained how to code the "submit order" button so that it becomes disabled after the customer presses it once. This will stop them from pressing it multiple times and causing duplicate orders.

Can this be posted again?

Thanks...
Reply With Quote
  #2  
Old 02-20-2004, 07:05 AM
  B00MER's Avatar 
B00MER B00MER is offline
 

X-Guru
  
Join Date: Sep 2002
Location: Keller, TX (Cart-Lab.com)
Posts: 3,165
 

Default

Code:
{*** Disable Submit order button once pressed by: www.cart-lab.com for: X-Cart Version 3.5.x template: customer/main/checkout.tpl ***} {*** Copy to skin1/customer/main/checkout.tpl ***} {literal} <SCRIPT language=JavaScript1.2> <!-- function classChange(element,newclass) { element.className = newclass; } if (document.getElementById){ //DynamicDrive.com change document.write('<style type="text/css">\n') document.write('.desc{display: none;}\n') document.write('</style>\n') } function switchcontent(obj){ if(document.getElementById){ var el = document.getElementById(obj); var ar = document.getElementById("meat").getElementsByTagName("span"); //DynamicDrive.com change if(el.style.display != "block"){ //DynamicDrive.com change for (var i=0; i<ar.length; i++){ if (ar[i].className=="sub") //DynamicDrive.com change ar[i].style.display = "none"; } el.style.display = "block"; }else{ el.style.display = "none"; } } } function submit_checkout() { //alert("'Submit' order button will be removed while we process your order, Press 'Ok' to continue processing your order."); document.checkout_form.submit(); switchcontent('submit'); } //--> </SCRIPT> {/literal} {*** End of disable submit order scripts ***} {*** Disable submit order button upon process of order ***} {if $js_enabled} <div id="meat"> <p align=center> <span id="submit" class="sub" style="display:block;"> {include file="buttons/submit_order.tpl"} </span> </div> {else} {include file="submit_wo_js.tpl" value=$lng.lbl_submit_order} {/if} {*** END OF Disable submit order button upon process of order ***}
__________________
Cart-Lab - 100+ Social Bookmarks for X-Cart.
Reply With Quote
  #3  
Old 06-18-2005, 06:44 PM
 
gman gman is offline
 

eXpert
  
Join Date: Sep 2002
Posts: 211
 

Default

Is this code just placed anywhere in the template? I am confused.
__________________
Gman



X-Cart Gold 4.6.0
Reply With Quote
  #4  
Old 06-18-2005, 07:44 PM
 
balinor balinor is offline
 

Veteran
  
Join Date: Oct 2003
Location: Connecticut, USA
Posts: 30,253
 

Default

Take a look at the code closely, the comments at the top explain it.
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
  #5  
Old 06-19-2005, 08:21 AM
 
gman gman is offline
 

eXpert
  
Join Date: Sep 2002
Posts: 211
 

Default

Ryan,
What I am seeing is:
Code:
{*** Disable Submit order button once pressed by: www.cart-lab.com for: X-Cart Version 3.5.x template: customer/main/checkout.tpl ***} {*** Copy to skin1/customer/main/checkout.tpl ***}
The only instruction I see is too copy it to the template. Is does nto say where in the template or if code gets replaced, etc. Sorry for being blind or stupid on this.
__________________
Gman



X-Cart Gold 4.6.0
Reply With Quote
  #6  
Old 06-21-2005, 07:33 AM
 
gman gman is offline
 

eXpert
  
Join Date: Sep 2002
Posts: 211
 

Default

Anyone feel free to jump in on this please.
__________________
Gman



X-Cart Gold 4.6.0
Reply With Quote
  #7  
Old 06-21-2005, 08:20 AM
  B00MER's Avatar 
B00MER B00MER is offline
 

X-Guru
  
Join Date: Sep 2002
Location: Keller, TX (Cart-Lab.com)
Posts: 3,165
 

Default

All code under this can go anywhere in your checkout.tpl file.

Code:
{*** Copy to skin1/customer/main/checkout.tpl ***}

This part needs to replace the anchor code (<A HREF..> until the included buttons/submit.tpl file.)

Code:
{*** Disable submit order button upon process of order ***}
__________________
Cart-Lab - 100+ Social Bookmarks for X-Cart.
Reply With Quote
  #8  
Old 06-21-2005, 11:15 AM
 
gman gman is offline
 

eXpert
  
Join Date: Sep 2002
Posts: 211
 

Default

Thanks all but the problem appears to be AFTER the checkout button is pushed and when they press the credit card button.
__________________
Gman



X-Cart Gold 4.6.0
Reply With Quote
  #9  
Old 06-21-2005, 01:19 PM
 
dsparks dsparks is offline
 

Advanced Member
  
Join Date: Nov 2002
Posts: 34
 

Default

I'm not sure what buttons you are talking about, I only see a checkout button, then a continue button on the payment selection type, then the submit order button.

Anyway, here is the code in case this helps. This disables the submit order button after it is pressed.

>>>>>>>>>>>>>

You said you are using version 3.5.12. I could only find a release with the version of 3.5.1.

I never installed the 3.5.1 version but I did install the patch on the 3.5.4 version.

I compared the checkout.tpl files for both versions (3.5.4 and 3.5.1) and they are exactly the same.

I have included a version of the checkout.tpl file with the patch already applied. You can either replace your checkout.tpl file or do a file comparison and make your own changes.

Hope this helps...





Code:
{* $Id: checkout.tpl,v 1.37 2003/11/17 12:10:16 mclap Exp $ *} {include file="location.tpl" last_location=$lng.lbl_payment_details} {capture name=checkout_dialog} <form action="cart.php" method=post name=cartform> {if $config.Appearance.show_cart_details eq "Y" or ($config.Appearance.show_cart_details eq "L" and $smarty.get.paymentid ne "" and $smarty.get.mode eq "checkout")} {include file="customer/main/cart_details.tpl"} {else} {include file="customer/main/cart_contents.tpl"} {/if} <HR noshade size=1> {include file="customer/main/cart_totals.tpl"} {if $js_enabled} {include file="buttons/update.tpl"} {else} {include file="submit_wo_js.tpl" value=$lng.lbl_update} {/if} </form> {/capture} {include file="dialog.tpl" title="`$lng.lbl_checkout`: `$lng.lbl_step` `$checkout_step` `$lng.lbl_of` `$total_checkout_steps`" content=$smarty.capture.checkout_dialog extra="width=100%"} {if $smarty.get.mode eq "auth"} {include file="main/error_login_incorrect.tpl"} {/if} {if $payment_data.payment_method ne ""} <h5>{$lng.lbl_payment_method}: {$payment_data.payment_method}</h5> {capture name=dialog} <table border=0 cellpadding=0 cellspacing=0 width=100%> <form action="{$payment_data.payment_script_url}" method=post name=checkout_form> <input type=hidden name=action value="place_order"> <tr><td> <pre> <font> {include file="customer/main/customer_details.tpl"} </font> </pre> {include file="buttons/modify.tpl"} {if $ignore_payment_method_selection eq ""} <div align=right> {include file="buttons/change_payment_method.tpl"} </div> {/if} <input type=hidden name={$XCARTSESSNAME} value={$XCARTSESSID}> {if $payment_data.payment_template ne ""} {include file=$payment_data.payment_template} {/if} {include file="customer/main/checkout_notes.tpl"} <input type=hidden name=payment_method value="{$payment_data.payment_method}"> {$lng.txt_you_are_agree} "{$lng.lbl_terms_n_conditions}" {$lng.lbl_and} "{$lng.lbl_privacy_statement}". <p align=center> {* =+=+=+=+=+=+=+=+=+= 20 Feb 2004 Change: DCS00080 *} {* {if $js_enabled} *} {* {include file="buttons/submit_order.tpl" style="button"} *} {* {else} *} {* {include file="submit_wo_js.tpl" value=$lng.lbl_submit_order} *} {* {/if} *} {literal} <SCRIPT language=JavaScript1.2> <!-- function classChange(element,newclass) { element.className = newclass; } if (document.getElementById){ //DynamicDrive.com change document.write('<style type="text/css">\n') document.write('.desc{display: none;}\n') document.write('</style>\n') } function switchcontent(obj){ if(document.getElementById){ var el = document.getElementById(obj); var ar = document.getElementById("meat").getElementsByTagName("span"); //DynamicDrive.com change if(el.style.display != "block"){ //DynamicDrive.com change for (var i=0; i<ar.length; i++){ if (ar[i].className=="sub") //DynamicDrive.com change ar[i].style.display = "none"; } el.style.display = "block"; }else{ el.style.display = "none"; } } } function submit_checkout() { //alert("'Submit' order button will be removed while we process your order, Press 'Ok' to continue processing your order."); document.checkout_form.submit(); switchcontent('submit'); } //--> </SCRIPT> {/literal} {*** End of disable submit order scripts ***} {*** Disable submit order button upon process of order ***} {if $js_enabled} <div id="meat"> <p align=center> <span id="submit" class="sub" style="display:block;"> {include file="buttons/submit_order.tpl"} </span> </div> {else} {include file="submit_wo_js.tpl" value=$lng.lbl_submit_order} {/if} {* =+=+=+=+=+=+=+=+=+= 20 Feb 2004 Change: DCS00080 *} </td></tr> </form> </table> {/capture} {include file="dialog.tpl" title=$lng.lbl_payment_details content=$smarty.capture.dialog extra="width=100%"} {elseif $payment_methods ne ""} {capture name=dialog} <form method=get action="cart.php" name=checkout_form> <table border=0 align=center> {section name=payment loop=$payment_methods} <tr> <td width=1><input type=radio name=paymentid value={$payment_methods[payment].paymentid}{if $payment_methods[payment].is_default eq "1"} checked{/if}></td> <td nowrap>{$payment_methods[payment].payment_method}</td> <td>{$payment_methods[payment].payment_details}</td> </tr> {/section} <input type=hidden name=mode value=checkout> </table> <div align=center> {if $js_enabled} {include file="buttons/continue.tpl" style="button"} {else} {include file="submit_wo_js.tpl" value=$lng.lbl_continue} {/if} </div> </form> {/capture} {include file="dialog.tpl" title=$lng.lbl_payment_method content=$smarty.capture.dialog extra="width=100%"} {/if}
__________________
X-Cart Gold: v4.0.17
Reply With Quote
  #10  
Old 06-21-2005, 02:44 PM
 
gman gman is offline
 

eXpert
  
Join Date: Sep 2002
Posts: 211
 

Default

dsparks,
I to see a continue button where you choose payment then continue to the next page. The first code above seems to replace that button, but I do not believe that is the button having the problem. I think it is the one on the credit card info page the one marked "Submit order" which is really the order button that is getting wacked twice.
__________________
Gman



X-Cart Gold 4.6.0
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 07:28 AM.

   

 
X-Cart forums © 2001-2020