Zen Cart Logo
Forums / General Questions / Attribute images?

Attribute images?

Locked

Views: 4,883

Results 1 to 16 of 16
This thread is locked. New replies are disabled.
7 Oct 2009, 7:46 PM
#1
terryparley avatar

terryparley

New Zenner

Join Date:
Sep 2009
Posts:
48
Plugin Contributions:
0

Attribute images?

I have a gazillion colors that I am adding color swatches to, is it possible to have the default option value for that color apply to all products that use that option value? Example: I have a t-shirt that uses the color black, I add that option value to the product, but the swatch does not appear, right now I have to to each product and add the swatch color. Hope that makes sense.

Terry

9 Oct 2009, 4:03 PM
#2
ajeh avatar

ajeh

Oba-san

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

Re: Attribute images?

You need to know from the products_attributes table the values of:
options_id
options_values_id
attributes_image

you can see these if you browse the table:
products_attributes

via phpMyAdmin ...

Then, to make, for example, all Color (options_id 1) Orange (options_values_id 25) with the Attributes image color_orange.gif (attributes/color_orange.gif) you could use:

UPDATE products_attributes SET attributes_image = 'attributes/color_orange.gif' WHERE options_id = 1 and options_values_id = 25;

in either the SQL of the phpMyAdmin or the Tools ... Install SQL Patches ... of your Zen Cart Admin ...

14 Oct 2009, 12:35 AM
#3
terryparley avatar

terryparley

New Zenner

Join Date:
Sep 2009
Posts:
48
Plugin Contributions:
0

Re: Attribute images?

I am sorry to say that your more than excellent suggestion is far above my understanding of SQL...:blush:

14 Oct 2009, 2:31 AM
#4
ajeh avatar

ajeh

Oba-san

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

Re: Attribute images?

Are you familiar enough with phpMyAdmin that you could find your database and browse the database table products_attributes to look at your Attributes?

If so, you want to find the contents of the fields:
options_id
options_values_id
attributes_image

wherre the attributes_image is the correct image that you have already added manually in the Zen Cart Admin with the Attributes Controller to one of your products ...

The example I showed has the options_id 1 (for Color) and options_values_id 25 (for Orange) and the image file, that I have in the directory /images/attributes/color_orange.gif

that in the database is stored as:
attributes/color_orange.gif

20 Oct 2009, 2:35 PM
#5
terryparley avatar

terryparley

New Zenner

Join Date:
Sep 2009
Posts:
48
Plugin Contributions:
0

Re: Attribute images?

Oh great and wise one! I found the attributes you spoke of, so here is what I found:

Gildan 5000 tshirt, the ash attribute id is 83313
Gildan 2000 tshirt, the ash attribute id is 83654

What am I doing wrong? Shouldn't the colors attributes be the same for Ash?

20 Oct 2009, 4:52 PM
#6
ajeh avatar

ajeh

Oba-san

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

Re: Attribute images?

You need to be more specific ...

The products_attributes table has fields:
options_id
options_values_id
attributes_image

You need to see if these are, or should, be the same on each product when they appear together ...

Example:
options_id 1
options_values_id 25
attributes_image attributes/color_orange.gif

Should all of those be the same when options_id is 1 and options_values_id is 25 and you want an image for that Attribute?

20 Oct 2009, 6:01 PM
#7
terryparley avatar

terryparley

New Zenner

Join Date:
Sep 2009
Posts:
48
Plugin Contributions:
0

Re: Attribute images?

There's that whole "be specific thing" lol...
Ok.. here is what I found for the color of ash

Gildan 2000 Shirt
Product Attribute id = 83654
Prod Id = 26
Options ID = 1
Options Value ID = 13

Gildan 5000 shirt
Product Attribute id = 83655
Prod Id = 27
Options ID = 1
Options Value ID = 13

Attributes_images = ash.gif for both shirts

So whenever I have a product that uses that color the attribute image is placed on the page, hope that makes sense? So when I apply the colors to a product, that color/attribute image then displays on the web page automatically.

Hope that is what you are asking for...

20 Oct 2009, 6:32 PM
#8
ajeh avatar

ajeh

Oba-san

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

Re: Attribute images?

To set all images on the attribute to ash.gif (where ash.gif is in the /images directory) for Options ID 1 and Options Values ID 13 you can use:

UPDATE products_attributes SET attributes_image = 'ash.gif' WHERE options_id = 1 and options_values_id = 13;

This can be run in the Tools ... Install SQL Patches ... of your Zen Cart Admin ... or in the phpMyAdmin SQL ...

NOTE: Backup before you try to do this ...

20 Oct 2009, 6:53 PM
#9
terryparley avatar

terryparley

New Zenner

Join Date:
Sep 2009
Posts:
48
Plugin Contributions:
0

Re: Attribute images?

I am guessing that I would have to do that for all the colors? do I just take the text you sent me and make a .txt file to run in the ZC to run the script?

20 Oct 2009, 7:08 PM
#10
ajeh avatar

ajeh

Oba-san

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

Re: Attribute images?

I would end it in .sql so there is no confusion ...

Make sure that each statement ends in a semi-colon as I wrote this one ...

That will allow you to update them any time you need to ...

20 Oct 2009, 7:51 PM
#11
terryparley avatar

terryparley

New Zenner

Join Date:
Sep 2009
Posts:
48
Plugin Contributions:
0

Re: Attribute images?

Is there a way to do this in mass for all the colors? Do I just copy the statement over and over in the .sql file and change the colors for each line?

20 Oct 2009, 8:27 PM
#12
ajeh avatar

ajeh

Oba-san

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

Re: Attribute images?

Set up 1 UPDATE statement per color ...

Change the options_values_id and the attributes_image ... assuming the options_id stays at 1 ...

Once you have made up your attributes_image_colors.sql file, you can load that any time ... it is pretty fast, btw, and it will update all of your attribute images for the colors ...

22 Oct 2009, 5:18 PM
#13
terryparley avatar

terryparley

New Zenner

Join Date:
Sep 2009
Posts:
48
Plugin Contributions:
0

Re: Attribute images?

YOU ARE AN ABSOLUTE GENIUS!!!! You have my vote to be support guru of the century!!!
Thank you from the bottom of my heart!!!:clap::clap::clap:

22 Oct 2009, 10:43 PM
#14
ajeh avatar

ajeh

Oba-san

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

Re: Attribute images?

You are most welcome ... remember us on the Zen Cart Team when you are rich and famous! :cool:

12 Nov 2009, 2:32 AM
#15
cdnbride avatar

cdnbride

Zen Follower

Join Date:
Sep 2009
Location:
Toronto, Canada
Posts:
149
Plugin Contributions:
0

Re: Attribute images?

I would just like to thank Ajeh for the fantastic information and detailed steps on this subject. I am a beginner and followed Ajeh's instructions here and BAM I got exactly what I wanted. Thanks sooo much I am loving Zen Cart even though it's tough to learn I'm happy to be here because there is so much valuable and positive support. :thumbsup:
Cheers!

Cdnbride

13 Nov 2009, 4:55 AM
#16
ajeh avatar

ajeh

Oba-san

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

Re: Attribute images?

You are most welcome and thanks for the update that this was able to help you ... :smile: