Zen Follower
- Join Date:
- Dec 2008
- Location:
- Pittsburgh, PA
- Posts:
- 241
- Plugin Contributions:
- 0
Automating Attributes (If in this (size) category > apply this attribute)
1.5.6
I was going to try to build a little script to blast in minimal data into the database but I'm struggling w/ an SQL query that would join the necessary data...
SELECT
p.products_id, p.products_status, p2c.*
FROM
products AS p
INNER JOIN
products_to_categories AS p2c
ON (p.products_id = p2c.products_id
AND p.products_status = 1
AND p2c.categories_id = 510)
Left JOIN
products_attributes AS pa
ON (pa.products_id = p.products_id
AND pa.options_values_id != 91)
..this query doesn't seem to succesfully apply the != 91...
Any thoughts/help would be helpful.
Pseudo code for "quick n dirty" context...
//run select query to get product_id's in Size 8 CATEGORY that do not have the Size 8 ATTRIBUTE
//apply/insert into size 8 attributes into attributes table
^then hard code into buttons.
Psuedo code for more useful version?
//make db table w/ 2/3 columns
//col 1 = id
// column 2 = size category id
// column 3 = size attribute ids to apply (comma delimited)
//create button to apply all paired category > size attributes
...also disclaimer, I've used attributes controller, was just looking for something I could build skills around doing, and want a way to quickly fix things I didn't easy populate attributes onto.
maybe I should explore easy populate a bit more a tool for this particular problem... but yeah, any thoughts?