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

Checkbox Validation

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #1  
Old 09-12-2006, 04:04 AM
  photo's Avatar 
photo photo is offline
 

X-Wizard
  
Join Date: Feb 2006
Location: UK
Posts: 1,146
 

Default 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.
__________________
v4.1.10
In Dev v4.5.x


"If you don't keep an eye on your business, someone else will."
Reply With Quote
  #2  
Old 02-17-2007, 11:25 AM
  Warwick's Avatar 
Warwick Warwick is offline
 

X-Adept
  
Join Date: Mar 2003
Location: Somewhere on the web through European connection
Posts: 868
 

Question Re: Checkbox Validation

Is this compatible with EZcheckout?

Thanks
__________________
Installs: X-Cart 4.1.x - 4.4.x ∙∙ MySQL version: 5.0.45 ∙∙ Apache version: 2.2.8 (Unix) ∙∙ PHP version: 5.25
X-Cart add-ons: all ∙∙ Mods: A lot; too many ∙∙ Skin templates: Many
∙∙ Experience: Somewhere beyond newbie
-----------------------------------
------------------------------------------------------------------------------------------------------
Looking for the best dutch language pack? 4.1.x - 4.6.x compatibel, native speaker translation! More info
Reply With Quote
  #3  
Old 02-27-2007, 07:29 PM
 
lcg lcg is offline
 

Senior Member
  
Join Date: Feb 2007
Posts: 106
 

Default 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
__________________
XCart v.4.0.18
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 05:21 AM.

   

 
X-Cart forums © 2001-2020