title: Magento home page popular products
body: <p>Hi All I want to show 4 popular products on the home page of my magento 1.7.1 install. (The I can select by putting them into a category).</p>
  
  <p>I've set this up by creating a hidden category called popularhome and added 4 products into it.</p>
  
  <p>I've included this in a static block into my home page template by using:</p>
  
  <pre><code>{{block type="catalog/product_list" column_count="4" category_id="17" template="catalog/product/listhome.phtml"}}
  </code></pre>
  
  <p>My listhome.phtml template looks like this:</p>
  
  <pre><code>&lt;div class="row popularproducts"&gt;
  
  &lt;?php
      $_productCollection=$this-&gt;getLoadedProductCollection();
      $_helper = $this-&gt;helper('catalog/output');
  ?&gt;
  &lt;?php if(!$_productCollection-&gt;count()): ?&gt;
  &lt;div class="alert fade in"&gt;
    &lt;a class="close" data-dismiss="alert"&gt;×&lt;/a&gt;
    &lt;?php echo $this-&gt;__('There are no products matching the selection.') ?&gt;
  &lt;/div&gt;
  &lt;?php else: ?&gt;
      &lt;?php // List mode ?&gt;
      &lt;?php if($this-&gt;getMode()!='grid'): ?&gt;
      &lt;?php $_iterator = 0; ?&gt;
      &lt;?php else: ?&gt;
      &lt;?php // Grid Mode ?&gt;
      &lt;?php $_collectionSize = $_productCollection-&gt;count() ?&gt;
      &lt;?php $_columnCount = $this-&gt;getColumnCount(); ?&gt;
      &lt;?php $i=0; foreach ($_productCollection as $_product): ?&gt;
          &lt;?php if ($i++%$_columnCount==0): ?&gt;
              &lt;?php endif ?&gt;
              &lt;div class="c3"&gt;
              &lt;?php if(($i-1)%$_columnCount==0): ?&gt;&lt;?php elseif($i%$_columnCount==0): ?&gt;&lt;?php endif; ?&gt;
                  &lt;div class="thumbnail"&gt;
                  &lt;a href="&lt;?php echo $_product-&gt;getProductUrl() ?&gt;" title="&lt;?php echo $this-&gt;stripTags($this-&gt;getImageLabel($_product, 'small_image'), null, true) ?&gt;" class="product-image thumbnail"&gt;&lt;img src="&lt;?php echo $this-&gt;helper('catalog/image')-&gt;init($_product, 'small_image')-&gt;resize(225); ?&gt;" alt="&lt;?php echo $this-&gt;stripTags($this-&gt;getImageLabel($_product, 'small_image'), null, true) ?&gt;" /&gt;&lt;/a&gt;
  
                  &lt;div class="caption"&gt;
                      &lt;h2 class="product-name"&gt;&lt;a href="&lt;?php echo $_product-&gt;getProductUrl() ?&gt;" title="&lt;?php echo $this-&gt;stripTags($_product-&gt;getName(), null, true) ?&gt;"&gt;&lt;?php echo $_helper-&gt;productAttribute($_product, $_product-&gt;getName(), 'name') ?&gt;&lt;/a&gt;&lt;/h2&gt;
                      &lt;?php if($_product-&gt;getRatingSummary()): ?&gt;
                      &lt;?php echo $this-&gt;getReviewsSummaryHtml($_product, 'short') ?&gt;
                      &lt;?php endif; ?&gt;
                      &lt;?php echo $this-&gt;getPriceHtml($_product, true) ?&gt;
                  &lt;/div&gt;
                  &lt;/div&gt;
                  &lt;/div&gt;
  
              &lt;?php if ($i%$_columnCount==0 || $i==$_collectionSize): ?&gt;
  
  
          &lt;?php endif ?&gt;
          &lt;?php endforeach ?&gt;
      &lt;?php endif; ?&gt;
  
  
  &lt;?php endif; ?&gt;
  
  &lt;/div&gt;
  </code></pre>
  
  <p>However this is only showing 2 of the 4 products yet I cannot figure out why? Does anyone see anything I am missing?</p>
  
  <p>Thanks!</p>