2

My problem:

At one point, everything was working fine. Associated simple products for a configurable product inherited the configurable products' categories. Then we reorganized some categories and added a few new ones, and now all existing child products' assigned categories have been wiped out, and when I create a new configurable product and use quick create to associate child products, it no longer passes the parent product's category assignments along.

What I've tried:

I've tried assigning products to categories through Manage Categories > Desired Category > Category Products tab > Reset Filter button > Check off all desired products, but then Magento becomes unhappy with me and won't make the change. Now it looks like I'm also stuck going through all the simple products manually and assigning categories.

Solution I'm looking for:

I do not want an extension as a solution, as we already are using several, and have had issues with them conflicting with each other. Is there a simple way to programmatically assign a parent product's categories to its child product? Or perhaps there's some setting that I'm overlooking?

Any help would be greatly appreciated!

user1609506
  • 21
  • 1
  • 5
  • I had this same problem, and posted my solution on this other SO question: http://stackoverflow.com/questions/22184352/copy-categories-from-parent-configurable-product-to-simple-child-product-in-mage I can't figure out how to flag it is a duplicate, perhaps a mod can help? – Eric Seastrand Nov 25 '14 at 22:58

1 Answers1

0

This is a task rather than a specific question.

It is pretty trivial to write an extension whose sole task would be to gather all of the configurable product, then set all of their child product's category_ids attribute to the original configurable's. Then use the cron to run it at certain intervals (like once a day or once a week).

It would be just as easy to make a stand alone script to do it too (though you would have to visit the page to run it).

danronmoon
  • 3,814
  • 5
  • 34
  • 56
Jared Kipe
  • 1,189
  • 6
  • 5
  • You're right, since I only want to do this one task, a stand-alone script would be ideal. The extension I thought people may suggest is one that allows bulk edits to be made, as this was mentioned in similar/related threads, but is too much for what I'm looking for. Would the script function the same way? (Setting child product category_ids attributes to the original configurable's) – user1609506 Mar 01 '13 at 17:11
  • Yes, `$collection = Mage::getModel('catalog/product')->getCollection()` after initializing the Mage::app() and you will be able to get a collection of products, iterate through them and update their attributes. – Jared Kipe Mar 01 '13 at 22:28
  • Also, if this answer helped you, you should Accept it as the answer. – Jared Kipe Mar 02 '13 at 18:56
  • I'm interested in seeing if this worked well for you? – Jeremy Aug 17 '14 at 22:30
  • Would you be willing to share the script you wrote to solve this problem or share what your final solution was? – Jeremy Aug 17 '14 at 22:31