I have 2 websites, each of which has 2 stores.
When I create a product from a store(say, Store 1) of a website(say, Website 1), and if I set the websites for this product as Website 1 and Website 2, the product's visibility is set as catalog, Search
only for the store from which I created it(Store 1). As for the other stores, the visibility is set to Not Visible Individually
.
I have an observer for catalog_product_save_before
, in which I want to set this visibility at store level.
Tried this code:
Mage::getModel('catalog/product_action')->updateAttributes(
array($productId),
array('visibility'=>4),
1
);
and it works. But for this, I need to get the productId, which I wont get since the product is not yet saved in my observer function.
How do I set this product visibility for a particular store(say Store 3 of Website 2) to catalog, Search
in the catalog_product_save_before
observer?