title: How can I show NEW products per row from specific categories in Magento?
body: <p>As the title suggests, I like to show new products called in from specific categories separated by rows in the home page.</p>
  <blockquote>
  <p>Row 1 -&gt; New products from Category 1</p>
  <p>Row 2 -&gt; New products from Category 2</p>
  <p>Row 3 -&gt; New products from Category 3</p>
  <p>...etc</p>
  </blockquote>
  <p>In my Magento Admin CMS, under Home Page they will be called in as separate blocks:</p>
  <pre><code>&lt;block type=&quot;catalog/product_new&quot; name=&quot;home.catalog.product.new_category_1&quot; alias=&quot;product_new_category_1&quot; template=&quot;catalog/product/new_category_1.phtml&quot;&gt;
  
  &lt;block type=&quot;catalog/product_new&quot; name=&quot;home.catalog.product.new_category_2&quot; alias=&quot;product_new_category_2&quot; template=&quot;catalog/product/new_category_2.phtml&quot;&gt;
  
  &lt;block type=&quot;catalog/product_new&quot; name=&quot;home.catalog.product.new_category_3&quot; alias=&quot;product_new_category_3&quot; template=&quot;catalog/product/new_category_3.phtml&quot;&gt;
  
  ...etc
  </code></pre>
  <p>Basically I’m thinking of duplicating <code>new.phtml</code> and calling it <code>new_category_1.phtml</code>, <code>new_category_2.phtml</code>, etc and get “new” products from category id 1, category id 2 respectively.</p>
  <p>I played with <code>Mage::getModel('catalog/category')-&gt;getCollection();</code>, <code>getProductCollection</code> and <code>getCatId</code> and can’t get it working in a copy of <code>new.phml</code> (<code>app/design/frontend/default/default/template/catalog/product/</code>).</p>
  <p>The code below works but does not load &quot;new&quot; assigned products within category id assigned, it loads all products within it.</p>
  <pre><code>&lt;?php 
                         
  $cat_id = 46; // category id
  $category = Mage::getModel('catalog/category')-&gt;load($cat_id);
  $products = $category-&gt;getProductCollection()-&gt;addCategoryFilter($category)-&gt;addAttributeToSelect('*');
  
  if (($products=($_products = $this-&gt;getProductCollection()) &amp;&amp; $_products-&gt;getSize())): ?&gt;
  
  &lt;div class=&quot;hp-report&quot;&gt;
      &lt;div class=&quot;head-alt&quot;&gt;
          &lt;h2 class=&quot;title&quot;&gt;&lt;?php echo $this-&gt;__('New Products') ?&gt;&lt;/h2&gt;
      &lt;/div&gt;
      &lt;table cellspacing=&quot;0&quot; class=&quot;generic-product-grid&quot; id=&quot;new-products-list-table&quot;&gt;
          &lt;tr&gt;
          &lt;?php $i=0; foreach ($_products-&gt;getItems() as $_product): ?&gt;
              &lt;?php if ($i&gt;=4): continue; endif; ?&gt;
          
              &lt;td&gt;
                  &lt;p class=&quot;product-image&quot;&gt;
                      &lt;a href=&quot;&lt;?php echo $_product-&gt;getProductUrl() ?&gt;&quot; title=&quot;&lt;?php echo $this-&gt;htmlEscape($_product-&gt;getName()) ?&gt;&quot;&gt;&lt;img src=&quot;&lt;?php echo $this-&gt;helper('catalog/image')-&gt;init($_product, 'small_image')-&gt;resize(170) ?&gt;&quot; width=&quot;170&quot; height=&quot;170&quot; alt=&quot;&lt;?php echo $this-&gt;htmlEscape($_product-&gt;getName()) ?&gt;&quot; /&gt;&lt;/a&gt;
                  &lt;/p&gt;
                  &lt;p&gt;&lt;a class=&quot;product-name&quot; href=&quot;&lt;?php echo $_product-&gt;getProductUrl() ?&gt;&quot; title=&quot;&lt;?php echo $this-&gt;htmlEscape($_product-&gt;getName()) ?&gt;)&quot;&gt;&lt;?php echo $this-&gt;htmlEscape($_product-&gt;getName()) ?&gt;&lt;/a&gt;&lt;/p&gt;
                  &lt;?php echo $this-&gt;getReviewsSummaryHtml($_product, 'short') ?&gt;
                  &lt;?php echo $this-&gt;getPriceHtml($_product, true, '-new') ?&gt;
                  &lt;?php if($_product-&gt;isSaleable()): ?&gt;
                      &lt;a href=&quot;&lt;?php echo $this-&gt;getAddToCartUrl($_product) ?&gt;&quot;&gt;&lt;img src=&quot;&lt;?php echo $this-&gt;getSkinUrl('images/btn_add_to_cart.gif') ?&gt;&quot; alt=&quot;&lt;?php echo $this-&gt;__('Add to Cart') ?&gt;&quot; title=&quot;&lt;?php echo $this-&gt;__('Add to Cart') ?&gt;&quot; /&gt;&lt;/a&gt;
                  &lt;?php else: ?&gt;
                  &lt;div class=&quot;out-of-stock&quot;&gt;&lt;?php echo $this-&gt;__('Out of stock') ?&gt;&lt;/div&gt;
                  &lt;?php endif; ?&gt;
                  &lt;div class=&quot;clear&quot;&gt;&lt;/div&gt;
                  &lt;ul class=&quot;add-to&quot;&gt;
                      &lt;?php if ($this-&gt;helper('wishlist')-&gt;isAllow()) : ?&gt;
                          &lt;li&gt;&lt;a href=&quot;&lt;?php echo $this-&gt;getAddToWishlistUrl($_product) ?&gt;&quot; class=&quot;link-cart&quot;&gt;&lt;?php echo $this-&gt;__('Add to Wishlist') ?&gt;&lt;/a&gt;&lt;/li&gt;
                      &lt;?php endif; ?&gt;
                      &lt;?php if($_compareUrl=$this-&gt;getAddToCompareUrl($_product)): ?&gt;
                          &lt;li&gt;&lt;a href=&quot;&lt;?php echo $_compareUrl ?&gt;&quot;&gt;&lt;?php echo $this-&gt;__('Add to Compare') ?&gt;&lt;/a&gt;&lt;/li&gt;
                      &lt;?php endif; ?&gt;
                  &lt;/ul&gt;
                  &lt;/td&gt;
          &lt;?php $i++; endforeach; ?&gt;
          &lt;?php for($i;$i%4!=0;$i++): ?&gt;
                  &lt;td&gt;&amp;nbsp;&lt;/td&gt;
              &lt;?php endfor ?&gt;
              &lt;/tr&gt;
      &lt;/table&gt;
      &lt;script type=&quot;text/javascript&quot;&gt;decorateTable('new-products-list-table');&lt;/script&gt;
  &lt;/div&gt;
  
  &lt;?php endif; ?&gt;
  </code></pre>
  <p>Any thoughts appreciated.</p>