Zen Cart Logo
Forums / Setting Up Categories, Products, Attributes / require at least one checkbox

require at least one checkbox

Views: 1,353

Results 1 to 6 of 6
3 Feb 2015, 6:29 PM
#1
paul3648 avatar

paul3648

Zen Follower

Join Date:
Mar 2007
Location:
Taiwan
Posts:
239
Plugin Contributions:
0

require at least one checkbox

My products are available in different weights, which have been set up with checkbox options.

I want the customer to be forced to click one of these checkboxes.

This page: http://www.zen-cart.com/content.php?208-ok-when-i-set-a-attribute-to-an-item-like-a-color-that-must-be-specified-and-i-enable-the-required-button-on-the-attribute-it-is-letting-customers-add-items-to-the-cart-without-giving-a-required-attribute-what-could-be-causing-this

says > To force selection of an attribute, you need to:

a. add an attribute that is Display-Only (ie: a color swatch that says "Please Select a Color").
b. Make it default.
This forces the customer to choose something "other than" the default (since the "default" is set to "display only").

This does not work on my 1.5.4 setup using the default template. The customer can click "Add to Cart" and the product is added to the cart without any attributes.

Using a text field option, I get the required effect, but then there is an unwanted text box on the page.

3 Feb 2015, 6:49 PM
#2
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: require at least one checkbox

What about using a dropdown?

3 Feb 2015, 6:57 PM
#3
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: require at least one checkbox

paul3648:

I want the customer to be forced to click one of these checkboxes.
Checkboxes are designed for "pick 0 or several"
Radio-buttons are designed for "pick exactly 1"

So, change it to radio-button instead of checkbox.

3 Feb 2015, 9:29 PM
#4
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: require at least one checkbox

If you use the default option in attributes controller, you can also use css to hide the default selected button so as to prevent confusion about something already being selected.

3 Feb 2015, 9:32 PM
#5
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: require at least one checkbox

With radio buttons, you'd simply leave it with nothing selected by default.

4 Feb 2015, 5:23 PM
#6
paul3648 avatar

paul3648

Zen Follower

Join Date:
Mar 2007
Location:
Taiwan
Posts:
239
Plugin Contributions:
0

Re: require at least one checkbox

Thanks for the feedback. I was hoping to allow the customer to select 1 or more options, hence the checkboxes. But the radio buttons are acceptable in most cases.