title: Magento Get Product Collection Filter By Store Id
body: <p>Both stores have a different root category. Main Store is the default sample data, Second Store has just one product I was added. I would have thought that using the store filter, only products within the root category of the current store would show up. But I'm getting every product showing. I'm testing this by placing the following in my category view template:</p>
  
  <pre><code>$store_id = Mage::app()-&gt;getStore()-&gt;getId();
  $_testproductCollection = Mage::getResourceModel('reports/product_collection')
  -&gt;setStoreId($storeId)
  -&gt;addStoreFilter($store_id)
  -&gt;addAttributeToSelect('*');
  $_testproductCollection-&gt;load();
  foreach($_testproductCollection as $_testproduct){ 
  echo $this-&gt;htmlEscape($_testproduct-&gt;getName()); 
  };
  </code></pre>
  
  <p>If I print the store ID, it's giving me the correct number. I have only one product in second Store , so why am I getting every product from all stores returned? I can set every product in Main Store to not show in Store2 and then add a visibility filter, but that would take forever.</p>
  
  <p>Also, I just noticed, if I echo the products store ID, I get the current ID, not the store it's assigned to:</p>
  
  <pre><code>echo $_testproduct-&gt;getStoreId()
  </code></pre>
  
  <p>How to solve this issue?</p>