title: How not to show out of stock products in magento homepage
body: <p>I have the following code which shows 4 random products in the homepage, however its also showing sometimes out of stock products, how can I avoid that?</p>
  
  <p>We want to show out of stock products on our website everywhere, except in the homepage.</p>
  
  <p>{{block type="catalog/product_list" category_id="108" template="catalog/product/list_home.phtml"}}</p>
  
  <pre><code> $_helper = $this-&gt;helper('catalog/output');
   $_category = Mage::getModel('catalog/category')-&gt;load($this-&gt;getCategoryId());
   $_productCollection = Mage::getResourceModel('reports/product_collection')
                         -&gt;addAttributeToSelect('*')
                         -&gt;addCategoryFilter($_category)
                         -&gt;setVisibility(array(2,3,4));
   $_productCollection-&gt;getSelect()-&gt;order(new Zend_Db_Expr('RAND()'));                  
   $_productCollection-&gt;setPage(1, 4);
  </code></pre>