title: Magento - Get store id before product create observer
body: <p>I want to add a few websites to a product based on the current store id in the <code>catalog_product_save_before</code> observer.</p>
  
  <p>The observer is working fine, but I can not seem to get the current store id from which the product is created. This is what I tried:</p>
  
  <pre><code>Mage::app()-&gt;getStore()-&gt;getId();
  </code></pre>
  
  <p>which returns 0.</p>
  
  <p>Magento treats admin panel as a separate store with name <code>admin</code> and id 0. So, it returns the store id for admin, which is not what I want.</p>
  
  <p>So, I tried a few things in <a href="https://magento.stackexchange.com/questions/6833/how-to-get-current-store-id-from-current-scope-in-admin">here</a>, and it still returns the id as 0.</p>
  
  <p><strong>More Details:</strong></p>
  
  <p>I have logged in as a store admin to enterprise.lmm.dev(virtual host for enterprise website) and am creating a product. Here, both the website name and store name is 'enterprise'.</p>
  
  <p>When creating a product, I choose 'enterprise' from the 'Choose Store View' drop-down and fills the product create form.</p>
  
  <p>I have written an observer function 'before_product_save()', in which this is what I do:</p>
  
  <pre><code>echo Mage::app()-&gt;getStore()-&gt;getStoreId();
  </code></pre>
  
  <p>But, this is returning 0.</p>
  
  <p>I want to know if this is the way to go and if I can access the store id for the store 'enterprise'.</p>
  
  <p>Thanks.</p>