title: Magento - Set product visibility on observer at store level before product save
body: <p>I have 2 websites, each of which has 2 stores.</p>
  
  <p>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 <code>catalog, Search</code> only for the store from which I created it(Store 1). As for the other stores, the visibility is set to <code>Not Visible Individually</code>.</p>
  
  <p>I have an observer for <code>catalog_product_save_before</code>, in which I want to set this visibility at store level.</p>
  
  <p>Tried this code:</p>
  
  <pre><code>Mage::getModel('catalog/product_action')-&gt;updateAttributes(
                      array($productId),
                      array('visibility'=&gt;4),
                      1
                  );
  </code></pre>
  
  <p>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.</p>
  
  <p>How do I set this product visibility for a particular store(say Store 3 of Website 2) to <code>catalog, Search</code> in the <code>catalog_product_save_before</code> observer?</p>