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)
-   -   Checkbox Validation (https://forum.x-cart.com/showthread.php?t=24840)

photo 09-12-2006 04:04 AM

Checkbox Validation
 
This mod is a adaptation of Zaja's must except terms mod http://forum.x-cart.com/showthread.php?t=20597
The differance is that if you do not check the "I agree to the terms and conditions" checkbox you will get a popup warning message.
This is for xcart version 4.1.3 it has not been extensively tested so use at your own risk.

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

<SCRIPT LANGUAGE="JavaScript">
<!-- Original:  Colin Pc  -->
<!-- Web Site:  http://www.insighteye.com/ -->
<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->

<!-- Begin
{literal}
function checkCheckBox(f){
if (f.agree.checked == false )
{
alert('You must agree to the terms and conditions to continue.');
return false;
}else
return true;
}
//  End -->
{/literal}
</script>

2. Replace:
Code:

{$lng.txt_terms_and_conditions_note}
with:
Code:

<input type="checkbox" value="0" name="agree"> {$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="submit" value="Submit Order" />
4. Replace:
Code:

<form action="{$payment_data.payment_script_url}" method="post" name="checkout_form">
with:
Code:

<form action="{$payment_data.payment_script_url}" method="post" name="checkout_form" onsubmit="return checkCheckBox(this)">
5. Repeat procedure in skin/customer/main/checkout.tpl (add javascript code after {capture name=checkout_dialog})

That should do it, if you find any issues please reply to this thread.

Warwick 02-17-2007 11:25 AM

Re: Checkbox Validation
 
Is this compatible with EZcheckout?

Thanks

lcg 02-27-2007 07:29 PM

Re: Checkbox Validation
 
*lol* Warwick (but good question hehe ;))

Great mod Photo, thanks and thanks to Zaja, but I have a question, I don't know where it's best to post it, if here or in http://forum.x-cart.com/showthread.php?t=20597&highlight=easy+checkout (original mod thread).

Instead of having a popup, which could be blocked by pop-up blockers could we make it so that when the user clicks on the "submit order" button without having check-marked the option a new text appears right above the button, perhaps in red colored type indicating "Please click on checkmark and submit order to continue?" (or something to this effect).

Thanks


All times are GMT -8. The time now is 05:20 PM.

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