Zen Cart Logo

ATTRIBUTES question

Views: 2,173

Results 1 to 11 of 11
3 May 2017, 5:29 PM
#1
cubmanky avatar

cubmanky

Zen Follower

Join Date:
Jan 2014
Posts:
224
Plugin Contributions:
0

ATTRIBUTES question

So I have a attribute option name of Color. In the Option value I have all the colors i have. This all works great!!!
The question. When I add a new product, then click to add attribute. Any way I can just click color and it automatically pick all the option values for color?

3 May 2017, 5:55 PM
#2
dbltoe avatar

dbltoe

Totally Zenned

Join Date:
Jan 2004
Location:
N of San Antonio TX
Posts:
9,805
Plugin Contributions:
15

Re: ATTRIBUTES question

This should get you started BUT... before you do, you need to add a color option value of "Please Select a Color" with the lowest sort order, set as display only, and default. They are the yellow and orange blocks in the attribute flags section.

Without this setting, a customer can accidentally order the wrong color. This setting forces them to select the color they really want before the item can be added to the cart.

Thread #108367

3 May 2017, 6:29 PM
#3
mc12345678 avatar

mc12345678

Totally Zenned

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

Re: ATTRIBUTES question

That's a new one. :) oh, wait you're asking about the admin side, I was thinking you wanted a customer to be able to click on the color option name and select all of the option values.

Two things can somewhat be done. Can copy a product that already has "all" of the attributes desired to be added and then modify the product information to suit. Or from the perspective described, if after you select the option name, then select the first option value, hold the shift key and press the end key, all attributes will be selected.

Otherwise, perhaps additional javascript code can be added to support a double click of the option name (ondblclick) to select all of the option values for that option name.

4 May 2017, 3:20 PM
#4
vdecals avatar

vdecals

Zen Follower

Join Date:
Jun 2009
Location:
Sparta, TN
Posts:
166
Plugin Contributions:
0

Re: ATTRIBUTES question

dbltoe:

add a color option value of "Please Select a Color" with the lowest sort order, set as display only, and default. They are the yellow and orange blocks in the attribute flags section.

Great advise. I've added this value to all my products. Is there a way to add/adjust this setting (display only and default) globally?
Thank you.

4 May 2017, 3:49 PM
#5
mc12345678 avatar

mc12345678

Totally Zenned

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

Re: ATTRIBUTES question

VDecalS:

Great advise. I've added this value to all my products. Is there a way to add/adjust this setting (display only and default) globally?
Thank you.
Had attributes from one product been copied to another product or category, then the settings from the original product would have carried over (at least when performed in the attributes controller). Otherwise would suggest a sql query to be performed against the database to apply both of those settings to any product that has the expected options_id and options_values_id associated with the attribute.

If you look in the option names manager, the number to the left of the option name is the options_id. Do the same for the options values manager to get the options_values_id. Then in admin->tools->install sql patches:

UPDATE products_attributes SET attributes_display_only=1, attributes_default=1 WHERE options_id = X AND options_values_id =Y;

Where X is the number for the options_id and Y is the number for the options_values_id. Can be further refined by product or other such data.

Or I guess, could just use options_values_id as that should be unique for each pair of option_name and option value.

4 May 2017, 4:45 PM
#6
vdecals avatar

vdecals

Zen Follower

Join Date:
Jun 2009
Location:
Sparta, TN
Posts:
166
Plugin Contributions:
0

Re: ATTRIBUTES question

Winged it! :onfire: I ended up copying product attributes to categories one at a time. I had to adjust for some attributes I didn't want on some products for one category, because I started with the most convoluted product :P. All looks good now!
Thanks a bunch!

4 May 2017, 4:59 PM
#7
mc12345678 avatar

mc12345678

Totally Zenned

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

Re: ATTRIBUTES question

Btw, if this is something you see as having to do frequently or in large batches (whether specifically attributes or other characteristics of product), there are other tools (plugins) that are designed to do large changes in short/quick bursts. They are all based off of the EasyPopulate concept.

4 May 2017, 9:00 PM
#8
dbltoe avatar

dbltoe

Totally Zenned

Join Date:
Jan 2004
Location:
N of San Antonio TX
Posts:
9,805
Plugin Contributions:
15

Re: ATTRIBUTES question

mc12345678:

UPDATE products_attributes SET attributes_display_only=1, attributes_default=1 WHERE options_id = X AND options_values_id =Y;
If all your actual attributes have a price, weight or some other identifiable item, it can be done quicker. For instance, if all regular attributes have a price assigned, you can use
UPDATE products_attributes SET attributes_display_only=1, attributes_default=1 WHERE options_values_price=0

11 Aug 2017, 7:13 PM
#9
vdecals avatar

vdecals

Zen Follower

Join Date:
Jun 2009
Location:
Sparta, TN
Posts:
166
Plugin Contributions:
0

Re: ATTRIBUTES question

I've just gotten a new color (NUT BROWN) to add to my vinyl decal attributes, but I only want to add (not replace) to products that currently have the color attribute of ORANGE.
Can someone let me know if the following SQL patch work?

ADD products attributes options_values_id = 73 WHERE options_id = X AND options_values_id = Y

73=NUT BROWN
X=color
Y=ORANGE

Thank you.

11 Aug 2017, 7:34 PM
#10
mc12345678 avatar

mc12345678

Totally Zenned

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

Re: ATTRIBUTES question

VDecalS:

I've just gotten a new color (NUT BROWN) to add to my vinyl decal attributes, but I only want to add (not replace) to products that currently have the color attribute of ORANGE.
Can someone let me know if the following SQL patch work?

ADD products attributes options_values_id = 73 WHERE options_id = X AND options_values_id = Y

> 
> 73=NUT BROWN
> X=color
> Y=ORANGE
> 
> Thank you.

Besides a few minor errors, there's actually a built in method to do this.

Access Catalog->Option Values Manager
Ensure that Display Global Features is set to on.

Then in the first "box" area below the initial list of option values, you select the attribute that product have that will be used to add the new attribute.

So, would select Option Name to match: Color
Option Value to Match: Orange

Then on the "right" side (middle "column") Option Name to Add: Color
Option Value to Add: Nut Brown

Then on the far right if you want to update a specific category of product, enter the category's id. If you want to update every product throughout the store, then leave it blank.

As to the "errors" above, there are multiple other columns of data that must be copied over to ensure that the new attribute row is associated to the appropriate product, also the table name to use would be products_attributes (missing an underscore in the above sql statement).  Basically though, using the above process would be better than trying to write a specific sql statement.  If you are trying to incorporate something into another program then would suggest that the associated code be reviewed to duplicate the action(s).
11 Aug 2017, 8:10 PM
#11
vdecals avatar

vdecals

Zen Follower

Join Date:
Jun 2009
Location:
Sparta, TN
Posts:
166
Plugin Contributions:
0

Re: ATTRIBUTES question

Zoinks! I knew I'd seen/used this before. Must remember to scroll down!
Thank you MC12345678!