title: Magento: show products from a specific category in the footer
body: <p>I'm building a "Product of the Month" block for the footer. It should load a category's products and display the first one.</p>
  
  <p>This is my template file <code>custom/featured-product.phtml</code>:</p>
  
  <pre><code>&lt;?php $_productCollection = $this-&gt;getLoadedProductCollection() ?&gt;
  
  &lt;div class="featured-product"&gt;
      &lt;h2&gt;&lt;?php echo $this-&gt;__('Product of the Month') ?&gt;&lt;/h2&gt;
  
      &lt;?php foreach ($_productCollection as $_product): ?&gt;
          &lt;div class="item"&gt;
              &lt;a class="product-image" href="&lt;?php echo $_product-&gt;getProductUrl() ?&gt;"&gt;
                  &lt;img src="&lt;?php echo $this-&gt;helper('catalog/image')-&gt;init($_product, 'small_image')-&gt;resize(200); ?&gt;" alt="&lt;?php echo $this-&gt;htmlEscape($this-&gt;getImageLabel($_product, 'small_image')) ?&gt;" /&gt;
              &lt;/a&gt;
  
              &lt;a class="product-name" href="&lt;?php echo $_product-&gt;getProductUrl() ?&gt;"&gt;&lt;?php echo $this-&gt;htmlEscape($_product-&gt;getName()) ?&gt;&lt;/a&gt;
  
              &lt;?php echo $this-&gt;getPriceHtml($_product, true) ?&gt;
          &lt;/div&gt;
  
          &lt;?php
          // Note: Exit after first product.
          break;
          ?&gt;
      &lt;?php endforeach ?&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>It's just a simplified version of Magento's product list template: <code>catalog/product/list.phtml</code></p>
  
  <h1><br>WORKING</h1>
  
  <p>When embedding the block in a CMS Page, it works fine. Example:</p>
  
  <pre><code>{{block type="catalog/product_list" category_id="13" template="custom/featured-product.phtml" }}
  </code></pre>
  
  <h1><br>NOT WORKING</h1>
  
  <p>When embedding the block via <code>local.xml</code>, it fails. The correct markup is returned but the specified category is not loaded. Instead a <em>random</em> (I don't how they're selected) set of products is loaded.</p>
  
  <p>My code in <code>local.xml</code>:</p>
  
  <pre><code>&lt;default&gt;
      &lt;reference name="footer"&gt;
          &lt;block type="catalog/product_list" name="custom.featuredProduct" as="product_of_the_month" category_id="13" template="custom/featured-product.phtml" /&gt;
      &lt;/reference&gt;
  &lt;/default&gt;
  </code></pre>
  
  <p>For completeness, I am rendering the block explicitly in <code>page/html/footer.phtml</code> like so:</p>
  
  <pre><code>&lt;?php echo $this-&gt;getChildHtml('product_of_the_month') ?&gt;
  </code></pre>
  
  <h1><br>Any ideas?</h1>
  
  <p>My best guess is my <code>local.xml</code> is incorrect. Is there a parent block I need to load?</p>
  
  <h1><br>[Updates]</h1>
  
  <p>My original code crashes the product page. The workaround is <em>not</em> basing the code so heavily on the Magento core file: <code>catalog/product/list.phtml</code>. Specifically avoiding this line:</p>
  
  <pre><code>&lt;?php $_productCollection = $this-&gt;getLoadedProductCollection() ?&gt;
  </code></pre>
  
  <h1><br>[Solution]</h1>
  
  <p>A working version with examples for use in CMS Pages and LayoutXML is included here:
  <a href="https://stackoverflow.com/a/12288000/1497746">https://stackoverflow.com/a/12288000/1497746</a></p>