0

Is there an easy way to copy a configurable product's category settings down to all its associated products?

A large number of products exist in the system without a category assigned (and thus aren't showing up in various product feeds).

Somewhere along the way, users changed how they entered data, so the category isn't getting copied down to associated products when they're being created.

  • The underlying problem was that a filter was being to stringent. If I tried to filter out a category (any category), it would drop that plus anything that didn't have a category. bug/feature? you decide. – SamC Jun 9 '14 at 18:19
1

If it were up to me, I would probably export the relevant items including Category ID, organize my CSV so all the associated simple items are aligned just beneath their corresponding configurable parent items, then drag down each configurable item's Category ID string to apply it to each simple item, accordingly. There may be a better way, but I often have great success doing many batch functions like this using CSV exports & imports. I highly recommend the free "Enhanced Admin Grids (+ Editor)" extension as it allows you to export customized lists of item data and can be incredibly helpful!

0

Here is a SQL query which will do exactly what you ask: Replicate each configurable products' categories into all of their simple children.

INSERT IGNORE INTO catalog_category_product 
            (category_id, 
             product_id) 
SELECT ccp.category_id, 
       cpl.product_id 
FROM   catalog_product_super_link cpl 
       LEFT JOIN catalog_category_product ccp 
              ON ccp.product_id = cpl.parent_id 
WHERE  ccp.category_id IN (SELECT entity_id 
                           FROM   catalog_category_entity);

catalog_product_super_link Simple Child<=>Parent Configurable relation

catalog_category_product Product<=>Category relation

INSERT IGNORE because we can expect some duplicate key errors

(I am having trouble explaining any more than that without being redundant; if there are specific questions please ask in comments.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.