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

How add required checkbox to checkout

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 08-19-2014, 08:14 AM
 
Martin Bishop Martin Bishop is offline
 

Advanced Member
  
Join Date: Sep 2011
Posts: 65
 

Default How add required checkbox to checkout

Hi

I want to add more required checkboxes to the checkout (in addition to the 'Yes I've read Ts and Cs and privacy statement' one). Is there a simple way to do this?

I tried adding some using CSS3 required responses but discovered this doesn't work in safari etc. so not ideal for a checkout.

thanks
Martin
__________________
4.4.3
Reply With Quote
  #2  
Old 08-19-2014, 12:03 PM
  totaltec's Avatar 
totaltec totaltec is offline
 

X-Guru
  
Join Date: Jan 2007
Location: Louisville, KY USA
Posts: 5,823
 

Default Re: How add required checkbox to checkout

Not exactly simple depending on what you want to do with the validation and/or record the submission. I've done this before by expanding the built in JavaScript in the form to encompass my additional box. And I've also written custom JS of my own to create popups with multiple checkboxes, then recorded the responses with the order.

I'm not familiar with your version at the moment, it's a little bit old now and my memory of it is fading. Do you have One Page Checkout? Is it the stock one included with the cart?

Looks like I have a working example of something like you want up on my test site: http://trainingpen.com/ (this site gets blown away and rebuilt from time to time)

It's based on a particular product being added to cart http://trainingpen.com/product.php?productid=17611 If you add that to cart and proceed to checkout a special checkbox will appear and it will display the sku.

If you want me to, I can hunt the code down for you and pass it along, though I would need to bill for the time as it will take a bit of work to find as its been a year or more. The solution is probably posted by me right on this forum, but I looked and googled and couldn't find it...
__________________
Mike White - Now Accepting new clients and projects! Work with the best, get a US based development team for just $125 an hour. Call 1-502-773-6454, email mike at babymonkeystudios.com, or skype b8bym0nkey

XcartGuru
X-cart Tutorials | X-cart 5 Tutorials

Check out the responsive template for X-cart.
Reply With Quote
  #3  
Old 08-19-2014, 12:11 PM
  totaltec's Avatar 
totaltec totaltec is offline
 

X-Guru
  
Join Date: Jan 2007
Location: Louisville, KY USA
Posts: 5,823
 

Default Re: How add required checkbox to checkout

Here is the basic idea that I could glean quickly, should put you on the right track:
Template: /ideal_responsive/modules/One_Page_Checkout/opc_summary.tpl
Code:
<div class="terms_n_conditions"> <label for="accept_terms"> <input type="checkbox" name="accept_terms" id="accept_terms" value="Y" /> {$lng.txt_terms_and_conditions_note|substitute:"terms_url":"`$xcart_web_dir`/pages.php?alias=conditions":"privacy_url":"`$xcart_web_dir`/pages.php?alias=business"} </label> </div>
Just duplicate that code and change the input name to "accept_two" or similar, update the label "for" too. Wipe out the language variable in the label and put your own text and links. Then search for the JavaScript and update the function to check for the second box, and that's the piece that would take me a bit to look up and work out for you.
__________________
Mike White - Now Accepting new clients and projects! Work with the best, get a US based development team for just $125 an hour. Call 1-502-773-6454, email mike at babymonkeystudios.com, or skype b8bym0nkey

XcartGuru
X-cart Tutorials | X-cart 5 Tutorials

Check out the responsive template for X-cart.
Reply With Quote

The following user thanks totaltec for this useful post:
Martin Bishop (08-20-2014)
  #4  
Old 08-20-2014, 12:51 AM
 
Martin Bishop Martin Bishop is offline
 

Advanced Member
  
Join Date: Sep 2011
Posts: 65
 

Default Re: How add required checkbox to checkout

Hi Mike

thanks very much for taking the time to have a look, it's really helpful. I'll have a go myself with your suggested method above and maybe give you a shout if I run up against a code wall (i.e. javascript).

many thanks
__________________
4.4.3
Reply With Quote
  #5  
Old 08-28-2014, 04:38 PM
  cherie's Avatar 
cherie cherie is offline
 

X-Wizard
  
Join Date: May 2003
Location: USA
Posts: 1,534
 

Default Re: How add required checkbox to checkout

Also change the id as they must be unique.
__________________
redlimeweb.com
custom mods and design integration
4.7 linux
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 09:11 AM.

   

 
X-Cart forums © 2001-2020