Magento – Set all associated product not visible individually

massactionproductproducts-management

how can I set all associated products in a group product be set 'not visible individually' in bulk?

Best Answer

Just a rough guide as this code has been covered a plenty ;)

  1. You can create a shell script to do this (see the shell folder). For an example look at /shell/log.php, all you'd really need is the run method in your shell script where the work is done.

  2. Have a look at this post: https://stackoverflow.com/questions/8579765/magento-how-do-i-get-associated-products-of-product-group From it you will find how to create a collection (of grouped products), and then get the associated products from that collection.

  3. You then simply iterate over the associated products, and set the visibility of each product.

    $product->setVisibility(Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH);