Reputation: 125
I have 8000 simple products without category assigned.
These simple products are used to create a lot some grouped products.
All grouped product have category assigned.
Is possible to assign grouped product category to all simple products that are associated to it?
Upvotes: 0
Views: 221
Reputation: 121
you could just try to add entries to catalog_category_product
table..:
INSERT IGNORE INTO catalog_category_product (category_id, product_id)
SELECT ccp.category_id, cpr.child_id FROM catalog_product_entity cpe
JOIN catalog_product_relation cpr ON cpr.parent_id = cpe.entity_id
JOIN catalog_category_product ccp ON cpe.entity_id = ccp.product_id
WHERE cpe.type_id = 'grouped'
ORDER BY cpe.entity_id
;
following SQL will add all simple products which are associated with any grouped products to all categories to which the grouped product is assigned. I wrote in just now and didn't test it so be sure to test it before launching on PRODUCTION db;-)
Upvotes: 1