Assigning products to multiple stores programmatically in magento

Let’s say you have a magento multi website/store installation and you want to assign the products of a particular category to the new store. I wrote a few lines of code to accomplish this. if (isset($_GET[‘dev_mode’]) && $_GET[‘dev_mode’] == ‘yes’) { $categoryIds = array(578,579); //category ids whose products you want to assign foreach ($categoryIds as … Continued