Zen Cart Logo
Forums / General Questions / Help Write SQL QUERY to Add Specific Attribute to ALL Products in Specific Category

Help Write SQL QUERY to Add Specific Attribute to ALL Products in Specific Category

Views: 1,356

Results 1 to 5 of 5
23 Feb 2014, 7:44 PM
#1
limelites avatar

limelites

Totally Zenned

Join Date:
Jan 2009
Posts:
2,085
Plugin Contributions:
0

Help Write SQL QUERY to Add Specific Attribute to ALL Products in Specific Category

I need to assign attribute #409 to every product in category #350.

Can anyone help me with the SQL QUERY I need to use please?

23 Feb 2014, 8:03 PM
#3
ajeh avatar

ajeh

Oba-san

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

Re: Help Write SQL QUERY to Add Specific Attribute to ALL Products in Specific Category

Have you ever peeked at the bottom of the screen on the Catalog ... Option Value Name ... and seen the section:

Copy Option Name/Value to Products with existing Option Name ... |

|

           Select an Option Name and  Value that currently exists on a product or products to add to all  products or to only the products in the selected category that have the  selected Option Name.                                                    

Example: Add Option Name: Color Option Value: Red to all Products with Option Name: Size
Example: Add Option Name: Color Option Value: Green with default values from Products ID: 34 to all Products with Option Name: Size
Example: Add Option Name: Color Option Value: Green with default values from Products ID: 34 to all Products with Option Name: Size for Categories ID: 65 |

Have you every wondered what might happen if you were to make a really good backup of your database and tried to see what would happen if you tried it?

Wouldn't it be cool if that was built into Zen Cart?! :lookaroun

I do believe that is the magic that you are looking for, but I gotta get going soon and did not play with it recently to be 100% positive, but that is why I think I built that in there eons ago ... :cool:

23 Feb 2014, 8:39 PM
#5
limelites avatar

limelites

Totally Zenned

Join Date:
Jan 2009
Posts:
2,085
Plugin Contributions:
0

Re: Help Write SQL QUERY to Add Specific Attribute to ALL Products in Specific Category

Hi Linda,

Thanks for getting back, really helpful as always. I always backup before running an SQL script but it seems to have worked well. The problem is with products in category 350. They don't really need any attributes but if we don't give them an attribute then the ADD TO CART button becomes hidden. So, now they all have an attribute "bespoke flowers".

It's a new site now. We finally upgraded to the latest Zen Cart:

https://www.silkblooms.co.uk