X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (https://forum.x-cart.com/forumdisplay.php?f=20)
-   -   Must "Accept terms" before submitting the order (https://forum.x-cart.com/showthread.php?t=20597)

Zaja 03-18-2006 08:04 AM

Must "Accept terms" before submitting the order
 
http://www.7dana.com/img/I_agree_demo.gif

1. open skin/customer/main/checkout.tpl and add following code after {capture name=checkout_dialog}:
Code:

<script type="text/javascript">
{literal}
//"Accept terms" form submission- By Dynamic Drive
var checkobj
function agreesubmit(el){
checkobj=el
if (document.all||document.getElementById){
for (i=0;i<checkobj.form.length;i++){
var tempobj=checkobj.form.elements[i]
if(tempobj.type.toLowerCase()=="button")
tempobj.disabled=!checkobj.checked
}}}
{/literal}
</script>


2. replace:
Code:

{$lng.txt_you_are_agree} "{$lng.lbl_terms_n_conditions}" {$lng.lbl_and} "{$lng.lbl_privacy_statement}".
with:
Code:

<input name="agreecheck" type="checkbox" onclick="agreesubmit(this)" /> {$lng.txt_you_are_agree} "{$lng.lbl_terms_n_conditions}" {$lng.lbl_and} "{$lng.lbl_privacy_statement}".

3. replace:
Code:

{include file="buttons/button.tpl" button_title=$lng.lbl_submit_order style="button" href=$button_href}
with:
Code:

<input type="button" value="{$lng.lbl_submit_order}" onclick="{$button_href}" style="padding: 4px; color: #BD0000; font-weight: bold;" disabled="disabled" />

Thats it! Using this hack, I have reduced the numbers of absurd questions by 30-40%. 8O

New 4.2 and 4.3 version(11-25-2009): http://www.7dana.com/Must-Accept-terms-before-submitting-the-order/

kenwood 03-18-2006 08:19 AM

Fine, thanx. And please now this hack for different languages.

B00MER 03-18-2006 08:39 AM

Quote:

Originally Posted by kenwood
Fine, thanks. And please now this hack for different languages.


Zaja kindly used language variables and no hard set text in the template. This mod can easily be localized.

Code:

alert("You must read accept terms to submit order")

Only part that isn't is the JS error alert.

Just change this to:

Code:

alert("{/literal}{$lng.txt_error_must_read|replace:"'":"\'"}{literal}")

Nice modification, defiantly something I never thought about. It's interesting how many don't read up before completing a purchase.

:mrgreen:

kenwood 03-18-2006 09:18 AM

perfect, thanx

nfc5382 06-20-2006 03:04 AM

thanks! great mod

crazyoval 06-21-2006 05:25 AM

some of this code is not around in 4.1, any ideas on what changes are required in 4.1? thanks

Zaja 06-26-2006 01:48 AM

v. 4.1.1, 4.1.2, 4.1.3:
-----------------

1. open skin/modules/Fast_Lane_Checkout/checkout_3_place.tpl and add following code after {capture name=dialog}:
Code:

<script type="text/javascript">
{literal}
//"Accept terms" form submission- By Dynamic Drive
var checkobj
function agreesubmit(el){
checkobj=el
if (document.all||document.getElementById){
for (i=0;i<checkobj.form.length;i++){
var tempobj=checkobj.form.elements[i]
if(tempobj.type.toLowerCase()=="button")
tempobj.disabled=!checkobj.checked
}}}
{/literal}
</script>


2. replace:
Code:

{$lng.txt_terms_and_conditions_note}
with:
Code:

<input name="agreecheck" type="checkbox" onclick="agreesubmit(this)" /> {$lng.txt_terms_and_conditions_note}

3. replace:
Code:

{include file="buttons/button.tpl" button_title=$lng.lbl_submit_order style="button" href=$button_href}
with:
Code:

<input type="button" value="{$lng.lbl_submit_order}" onclick="{$button_href}" style="padding: 4px; color: #BD0000; font-weight: bold;" disabled="disabled" />

4. Repeat procedure in skin/customer/main/checkout.tpl (add javascript code after {capture name=checkout_dialog})

Thats it!

crazyoval 06-26-2006 01:56 AM

cheers Zaja! thank you.

Im using your Soft Blue template by the way :D

Amy 07-13-2006 06:17 AM

great add on - will test it out soon.

jeeya 07-13-2006 09:47 PM

Thanks! Works Perfect in 4.1.2.


All times are GMT -8. The time now is 09:42 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2022, Jelsoft Enterprises Ltd.