Zen Cart Logo
Forums / Setting Up Categories, Products, Attributes / Setting an attribute to be 'Required' does not work.

Setting an attribute to be 'Required' does not work.

Views: 3,167

Results 1 to 20 of 37
26 Feb 2014, 11:23 PM
#1
mike_d_1 avatar

mike_d_1

New Zenner

Join Date:
Sep 2013
Location:
Honolulu, HI
Posts:
88
Plugin Contributions:
0

Setting an attribute to be 'Required' does not work.

The products we sell (tours/activities) are such that we need to know certain things to process an order.

I've checked the red boxes in the attribute controller to make those specific attributes required, and it definitely worked, I remember it sending me back to the product page and telling me to fill required things in.

But I haven't checked it in a while and I've come a long way since I remember it working the way I wanted it to. I've made several changes, installed add-ons, etc., and now it doesn't appear to matter whether or not I check an attribute as required, even if a required attribute is left blank the product is still added to cart.

Is there a way to switch that back on? I'm not even sure what I did to turn it off in the first place.

26 Feb 2014, 11:28 PM
#2
mc12345678 avatar

mc12345678

Totally Zenned

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

Re: Setting an attribute to be 'Required' does not work.

Mike D:

The products we sell (tours/activities) are such that we need to know certain things to process an order.

I've checked the red boxes in the attribute controller to make those specific attributes required, and it definitely worked, I remember it sending me back to the product page and telling me to fill required things in.

But I haven't checked it in a while and I've come a long way since I remember it working the way I wanted it to. I've made several changes, installed add-ons, etc., and now it doesn't appear to matter whether or not I check an attribute as required, even if a required attribute is left blank the product is still added to cart.

Is there a way to switch that back on? I'm not even sure what I did to turn it off in the first place.

To help others help you, please provide an example product (via web address), and if possible, please be more specific about the settings for the product(s) and the applicable attributes.

27 Feb 2014, 1:57 AM
#3
twitchtoo avatar

twitchtoo

Totally Zenned

Join Date:
Apr 2007
Location:
Ontario, Canada
Posts:
1,732
Plugin Contributions:
14

Re: Setting an attribute to be 'Required' does not work.

Mike D:

The products we sell (tours/activities) are such that we need to know certain things to process an order.

I've checked the red boxes in the attribute controller to make those specific attributes required, and it definitely worked, I remember it sending me back to the product page and telling me to fill required things in.

But I haven't checked it in a while and I've come a long way since I remember it working the way I wanted it to. I've made several changes, installed add-ons, etc., and now it doesn't appear to matter whether or not I check an attribute as required, even if a required attribute is left blank the product is still added to cart.

Is there a way to switch that back on? I'm not even sure what I did to turn it off in the first place.

Make cup of tea.

You've admitted installing upgrades, it sounds like you've wiped out the switch.

Sip the tea.

Check the product page the switch should be on for functionality, switch between your current template and the Classic Green template to find out if it's a problem with the template files or the core files.

Report back when the tea is empty.

27 Feb 2014, 2:00 AM
#4
mike_d_1 avatar

mike_d_1

New Zenner

Join Date:
Sep 2013
Location:
Honolulu, HI
Posts:
88
Plugin Contributions:
0

Re: Setting an attribute to be 'Required' does not work.

http://www.shakatourshonolulu.com/ocean-activities/wild-dolphin-safari

I've changed every attribute for this product to required and it still gets to the cart with missing attributes.

I don't know where exactly things are going wrong - hence the forum post - but I did change a number of stock zen cart things to get where I am. For instance, the price of a product is dynamically calculated by a javascript running on the page that calculates the price based on some of the attributes. The actual price of the product is set to $1 so the javascript inserts the "price" that it calculated into the qty field, which sets the price.

Will try tea suggestion now...

27 Feb 2014, 2:38 AM
#5
mike_d_1 avatar

mike_d_1

New Zenner

Join Date:
Sep 2013
Location:
Honolulu, HI
Posts:
88
Plugin Contributions:
0

Re: Setting an attribute to be 'Required' does not work.

twitchtoo:

Make cup of tea.

You've admitted installing upgrades, it sounds like you've wiped out the switch.

Sip the tea.

Check the product page the switch should be on for functionality, switch between your current template and the Classic Green template to find out if it's a problem with the template files or the core files.

Report back when the tea is empty.

Ok I've still got tea left but I plan on refilling the cup anyway...

I've switched between templates and the "switch" appears to be unaffected, the product is still added to the cart no matter which template I use.

27 Feb 2014, 3:02 AM
#6
twitchtoo avatar

twitchtoo

Totally Zenned

Join Date:
Apr 2007
Location:
Ontario, Canada
Posts:
1,732
Plugin Contributions:
14

Re: Setting an attribute to be 'Required' does not work.

Ok then it's a change to the modules, classes or functions related to the product page... Or the switch is working and the attribute conditions are not within the scope of the existing code.

Can you get it working with a new product that doesn't have any extras added to it? Perhaps try with a different product type?

28 Feb 2014, 2:24 AM
#7
mike_d_1 avatar

mike_d_1

New Zenner

Join Date:
Sep 2013
Location:
Honolulu, HI
Posts:
88
Plugin Contributions:
0

Re: Setting an attribute to be 'Required' does not work.

twitchtoo:

Ok then it's a change to the modules, classes or functions related to the product page... Or the switch is working and the attribute conditions are not within the scope of the existing code.

Can you get it working with a new product that doesn't have any extras added to it? Perhaps try with a different product type?

We've got an existing product on our site (http://www.shakatourshonolulu.com/hpu/hpu-turtle-canyon-snorkel) that doesn't use the javascript calculator to figure out the price but good ol' zen cart all the way. I've changed all the attributes to required and when I leave it blank it still hits the shopping cart.

I tried testing different product types last night, music and documents, but for some reason the attributes I add to the products don't show up.

And actually, today, I'm having a new problem. I disabled the status to the category for the products i was testing. Now I can't change the status of any products or categories. Chrome keeps spitting "No Data Received" back at me. Gonna see if I can't take care of that and post back.

28 Feb 2014, 3:58 AM
#8
mike_d_1 avatar

mike_d_1

New Zenner

Join Date:
Sep 2013
Location:
Honolulu, HI
Posts:
88
Plugin Contributions:
0

Re: Setting an attribute to be 'Required' does not work.

Oh boy...so I don't think I did anything major today. Switched between templates a bit. Created a couple new products, deleted a few new products. Changed the status for one of those products and I changed an option in admin for music product types then changed it back but that's it...and now I can't seem to change the status of any products or categories.

The new product I changed to "status off" (red box instead of green) I can still access (http://www.shakatourshonolulu.com/test/test-product) even though it's set to disabled. The other disabled things are inaccessible. What gives?

I was hoping it was a server issue but everything else appears to be working fine. Did I fat-finger it? Any ideas?

28 Feb 2014, 4:15 AM
#9
mc12345678 avatar

mc12345678

Totally Zenned

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

Re: Setting an attribute to be 'Required' does not work.

Mike D:

Oh boy...so I don't think I did anything major today. Switched between templates a bit. Created a couple new products, deleted a few new products. Changed the status for one of those products and I changed an option in admin for music product types then changed it back but that's it...and now I can't seem to change the status of any products or categories.

The new product I changed to "status off" (red box instead of green) I can still access (http://www.shakatourshonolulu.com/test/test-product) even though it's set to disabled. The other disabled things are inaccessible. What gives?

I was hoping it was a server issue but everything else appears to be working fine. Did I fat-finger it? Any ideas?

By what methodare you trying to enable/disable? Just clicking on the red/green button when looking at the list of products/categories? That's related to a file setup in that file. Last time I helped someone with that, I said it was a PoST/GET issue, then realized that there was a thread that talked about an early problem (no longer existent) with Image Handler (all because the code for that plugin was of an older version of ZC), the thread had a fix link in it and while it discusses IH, it is all about the file that is probably giving you trouble.

On the other side of things, and a little slower, you should still be able to change the status when reviewing the product. (First set of radio buttons). I'll look for the thread and see if I can find it again.

As for your required attribute(s), I went to the one product initially provided, I entered nothing, and when selecting add-to-cart, sure the "cart" appeared, but it was empty. Same as when I selected a date, but once I select a quantity, then it got added to the cart. At no time did I receive any type of error message, which was a bit of a surprise. Anyways, what is it that you are trying to make required again? Normally when something is required the template changes the surrounding text to show like an asterisk (*) or something. Don't see anything indicating any required attributes.

28 Feb 2014, 4:31 AM
#10
mike_d_1 avatar

mike_d_1

New Zenner

Join Date:
Sep 2013
Location:
Honolulu, HI
Posts:
88
Plugin Contributions:
0

Re: Setting an attribute to be 'Required' does not work.

mc12345678:

By what methodare you trying to enable/disable? Just clicking on the red/green button when looking at the list of products/categories? That's related to a file setup in that file. Last time I helped someone with that, I said it was a PoST/GET issue, then realized that there was a thread that talked about an early problem (no longer existent) with Image Handler (all because the code for that plugin was of an older version of ZC), the thread had a fix link in it and while it discusses IH, it is all about the file that is probably giving you trouble.

On the other side of things, and a little slower, you should still be able to change the status when reviewing the product. (First set of radio buttons). I'll look for the thread and see if I can find it again.

As for your required attribute(s), I went to the one product initially provided, I entered nothing, and when selecting add-to-cart, sure the "cart" appeared, but it was empty. Same as when I selected a date, but once I select a quantity, then it got added to the cart. At no time did I receive any type of error message, which was a bit of a surprise. Anyways, what is it that you are trying to make required again? Normally when something is required the template changes the surrounding text to show like an asterisk (*) or something. Don't see anything indicating any required attributes.

Yep, just clicking the red/green box to enable/disable things. Worked fine until today. I did see the thread about imagehandler but since I don't have that installed figured it probably doesn't apply to me.

I'll see if I can find those radio buttons.

I believe the reason the cart appears but shows nothing is because if you neglect to enter a value for amount of people, nobody is going on the tour/activity so it won't cost anything, and I'm thinking zen cart interprets that as $0 so there's nothing to add to the cart (assumption only, I don't know what zen cart is doing). The lack of error message is exactly my problem, I'm not sure what's causing it and I wish I hadn't stopped making daily backups a month ago when I thought I had it all figured out. I can tell you that when I did have it working and zen cart was telling me that I hadn't filled in the required fields (I'd land back on the product page with the required things at the top of the screen) there weren't asterisks next to the attributes at the bottom of the page.....unless you mean the asterisks were in the error message in which case I can't remember if there were asterisks or not.

28 Feb 2014, 4:46 AM
#11
mc12345678 avatar

mc12345678

Totally Zenned

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

Re: Setting an attribute to be 'Required' does not work.

Mike D:

Yep, just clicking the red/green box to enable/disable things. Worked fine until today. I did see the thread about imagehandler but since I don't have that installed figured it probably doesn't apply to me.

I'll see if I can find those radio buttons.

I believe the reason the cart appears but shows nothing is because if you neglect to enter a value for amount of people, nobody is going on the tour/activity so it won't cost anything, and I'm thinking zen cart interprets that as $0 so there's nothing to add to the cart (assumption only, I don't know what zen cart is doing). The lack of error message is exactly my problem, I'm not sure what's causing it and I wish I hadn't stopped making daily backups a month ago when I thought I had it all figured out. I can tell you that when I did have it working and zen cart was telling me that I hadn't filled in the required fields (I'd land back on the product page with the required things at the top of the screen) there weren't asterisks next to the attributes at the bottom of the page.....unless you mean the asterisks were in the error message in which case I can't remember if there were asterisks or not.

The asterisks (or other configureable indicator) I was referring to was the character that would be next to say, first name, if that was a required field. Seems like you have the show cart after adding product set, and the problem you are experiencing with the buttons, well even though it has nothing to do with image handler, it just so happens that the same system response was occurring and likely for the same reason, a file was "updated" or uploaded but of the wrong version. Because of that, I would also question the other files. (Files are different than the database). If possible, would recommend either restoring the backup made before whatever change caused your problem, or comparing your site to a fresh set of files and verify that changes that were made were expected.

It seems that because the same system response is occurring on all templates, that it seems that core/base files were modified and that the cart should be verified to have the appropriate files.

28 Feb 2014, 4:51 AM
#12
mike_d_1 avatar

mike_d_1

New Zenner

Join Date:
Sep 2013
Location:
Honolulu, HI
Posts:
88
Plugin Contributions:
0

Re: Setting an attribute to be 'Required' does not work.

Found the radio buttons and they do the trick on changing the status. Thanks for that.

What's more....now the attributes I added to the new products actually do show up (no idea why).

But I can still add products without the required attributes...

28 Feb 2014, 4:52 AM
#13
mike_d_1 avatar

mike_d_1

New Zenner

Join Date:
Sep 2013
Location:
Honolulu, HI
Posts:
88
Plugin Contributions:
0

Re: Setting an attribute to be 'Required' does not work.

mc12345678:

The asterisks (or other configureable indicator) I was referring to was the character that would be next to say, first name, if that was a required field. Seems like you have the show cart after adding product set, and the problem you are experiencing with the buttons, well even though it has nothing to do with image handler, it just so happens that the same system response was occurring and likely for the same reason, a file was "updated" or uploaded but of the wrong version. Because of that, I would also question the other files. (Files are different than the database). If possible, would recommend either restoring the backup made before whatever change caused your problem, or comparing your site to a fresh set of files and verify that changes that were made were expected.

It seems that because the same system response is occurring on all templates, that it seems that core/base files were modified and that the cart should be verified to have the appropriate files.

Do you know which files specifically I should be checking?

2 Mar 2014, 5:46 AM
#14
mc12345678 avatar

mc12345678

Totally Zenned

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

Re: Setting an attribute to be 'Required' does not work.

Mike D:

Do you know which files specifically I should be checking?

Okay, so I just ran a little test with the template that I am using. I was wrong that the fields would automatically have some sort of identifier adjacent to them if they were required. That is something that is captured in a few other areas such as the contact_us window, the sign-in and account creation screens, etc... If you wanted to add that type of functionality, then you would be more than likely making changes to the templates that display the applicable information. In this case, it seems it would be in the tpl_modules_attributes file (at least upon initial review of the file.) and the file should be copied to your current/desired template before making any changes, then the thing to do is to use some sort of data that is returned from the database, if the data represents that the field is required, then to present an indicator that the field is required...

So, next thing I did was try to determine what attribute(s) were needed to prevent adding the item to the cart if not selected.

I tried radio buttons, but I couldn't make a setting that even though I hadn't selected a radio button would prevent adding the item to the cart. The only way of using some sort of multi-select option was to use a dropdown, with a single item added to my list such that it read something like "Please select one of the below in order to purchase this item." set that to display only and default and then if I tried to add the item to the cart without selecting something other than that first item, I received an error. Other attributes that I used were text fill in boxes (similar to what you had such as first name etc...) and with them set as required, I could not add the product unless I had at least one character in the field (space counted as a character I think). I don't see/don't recall that there is a default setting for the minimum values to be in fields like that... It may need to be programmed/added in to accomplish that. Anyways, that's how I am able to control a product from being added to the cart if there is something that I expect/require. Ohh, I forgot to mention, for the Option Names that I consider required I added my own text to the name to express that it is required. So instead of Name:, I have Name (Req'd):

4 Mar 2014, 12:06 AM
#15
mike_d_1 avatar

mike_d_1

New Zenner

Join Date:
Sep 2013
Location:
Honolulu, HI
Posts:
88
Plugin Contributions:
0

Re: Setting an attribute to be 'Required' does not work.

My problem is actually that I've "wiped out the switch" or something along those lines.

My shopping cart was working the way you explained with required attributes. If the attributes I set as required weren't present when I hit the add-to-cart button I'd end up back on the product page with the yellow error box with missing required attributes at the top of the page. I must have done something, though, because no matter how I set an attribute to be required, it's accepted no matter what.

Could it have something to do with Zen Cart's sanitizing/validating abilities? I know that zen cart on its own is PCI Compliant, which I assume means it has some way of sanitizing information of malicious code, but my cart does no such thing (one of the reasons why I keep failing my PCI Compliance scan). Have I changed that somehow?

I've been comparing the core files to an unchanged version to see if anything jumps out at me but so far I got nothing. Thanks so much for taking the time to help me.

4 Mar 2014, 1:04 AM
#16
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Setting an attribute to be 'Required' does not work.

If you were to turn off your SEO/rewrites ... does this fix it?

If you were to switch, for a minute, to the Classic Template, does it fix it?

4 Mar 2014, 1:24 AM
#17
mike_d_1 avatar

mike_d_1

New Zenner

Join Date:
Sep 2013
Location:
Honolulu, HI
Posts:
88
Plugin Contributions:
0

Re: Setting an attribute to be 'Required' does not work.

Ajeh:

If you were to turn off your SEO/rewrites ... does this fix it?

If you were to switch, for a minute, to the Classic Template, does it fix it?

Tried turning the URI mapping off with and without the Classic Green template running and the same problem occurs.

4 Mar 2014, 1:26 AM
#18
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Setting an attribute to be 'Required' does not work.

Could you perhaps do a nice screenshot or so of your Attributes in the Attributes Control Panel so that we might see the settings and such?

4 Mar 2014, 1:35 AM
#19
mike_d_1 avatar

mike_d_1

New Zenner

Join Date:
Sep 2013
Location:
Honolulu, HI
Posts:
88
Plugin Contributions:
0

Re: Setting an attribute to be 'Required' does not work.

Ajeh:

Could you perhaps do a nice screenshot or so of your Attributes in the Attributes Control Panel so that we might see the settings and such?

Attachment 13855

Is this what you're looking for?

4 Mar 2014, 2:06 AM
#20
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Setting an attribute to be 'Required' does not work.

The Attribute setting for:

Attribute Required
for Text:

Is only used for TEXT Attributes and has no effect on Attribute that are Radiobuttons or Dropdowns ...

On the dropdown for:

With Transportation?

You have YES and NO as Option Values ... add another one such as:
Select your method
Display Only YES
Default YES
Sort Order 0

What that does is force a choice to be made of either YES or NO and not an "accidental" choice ...

I am not, at the moment, seeing why your TEXT attributes are not working with the built in setting on the:

Attribute Required
for Text:

Are you using any addons for Attributes?