Adding an extra field enabled by a checkbox during checkout

Questions and answers about ShopSite Custom Templates

Adding an extra field enabled by a checkbox during checkout

Postby xylemdesign » Mon Mar 17, 2014 9:45 am

I'm looking to add a checkbox or two that will enable a text field to be opened up for the user to input an optional date needed by field. I have tried to add this with my own javascript and html to interact with a field already in place but the javascript won't run properly, I'm guessing that is because of checkout security. Does anyone know how to add this kind of interaction to shopsite?

**EDIT**
Here's a link that show what I want.
http://www.pedestalsource.com/checkbox.html
xylemdesign
 
Posts: 28
Joined: Mon Mar 17, 2014 9:36 am

Re: Adding an extra field enabled by a checkbox during check

Postby ShopSite Lauren » Mon Mar 17, 2014 10:21 am

It should work in the shopping cart. Can you give me the URL of a product in your store so that I can add it to the cart to see this feature and how you have it setup?

What I would suggest would be to go to Commerce Setup > Order System > Checkout, and enable the custom checkout fields, and the customer checkout field 1. Don't make this field required, because not all orders will use it.

Then in one of the text fields on the Commerce Setup > Order System > Checkout screen, add the following HTML:
Code: Select all
<input type="checkbox" id="standard" name="standard" value="Standard" onchange="calcStandard();" checked/>Standard processing time of two to three weeks
<br><input type="checkbox" id="needByDate"name="rush" value="Rush Processing" onchange="calcRush();"/>Need to arrive before or on a certain date.
<span id="date-wrapper" style="display: none">
<input type="text" id="dateBox" name="field01" placeholder="Date Needed By"/>
<br><strong>Some rush delieveries may require a fee, a customer service representative will contact you if your date requires rush processing.</strong>
</span>
<script src="https://www.pedestalsource.com/js/cart.js"></script>


Note, I have added the full SECURE URL to the script file, and I have removed the <form></form> tags. because the field01 is part of the checkout screen form.
- ShopSite Lauren
Contact me for help with any of your
custom ShopSite template questions.
ShopSite Lauren
 
Posts: 889
Joined: Fri Aug 11, 2006 1:35 pm
Location: Orem, UT

Re: Adding an extra field enabled by a checkbox during check

Postby xylemdesign » Mon Mar 17, 2014 10:40 am

Thanks for your help, here's a product you could add http://www.pedestalsource.com/Economy/BlackLaminatePedestal.htm , I will try to add the buttons again now.
xylemdesign
 
Posts: 28
Joined: Mon Mar 17, 2014 9:36 am

Re: Adding an extra field enabled by a checkbox during check

Postby xylemdesign » Mon Mar 17, 2014 11:38 am

Thanks! The buttons are now added and they are functional. Is there anyway I can get that date, if entered, to be present on the confirmation screen?
xylemdesign
 
Posts: 28
Joined: Mon Mar 17, 2014 9:36 am

Re: Adding an extra field enabled by a checkbox during check

Postby ShopSite Lauren » Mon Mar 17, 2014 11:52 am

If it is in the custom checkout field, then that is a custom checkout field setting. If you go to Commerce Setup > Order System > Checkout, and next to the field01 settings, there are a list of checkboxes on where you would like this information displayed. However, it does look like you have a custom shopping cart template, so you will want to make sure that your custom template has the [-- IF CustomHTML_Values --][-- CustomHTML_Values --][-- END_IF --] tags in your shopping cart template within the DEFINE Confirmation and DEFINE Thank_You sections.
- ShopSite Lauren
Contact me for help with any of your
custom ShopSite template questions.
ShopSite Lauren
 
Posts: 889
Joined: Fri Aug 11, 2006 1:35 pm
Location: Orem, UT


Return to Custom Template Questions

Who is online

Users browsing this forum: No registered users and 10 guests

cron