title: load product in particular category in magento
body: <p>I am creating navigation for my store. I am new to magento. I am having problem to load product under that category. It is possible for me to print all product under all categories but I don't know how to load products under its specific category.</p>
  
  <p>This is my code</p>
  
  <pre><code>&lt;?php $_menu = $this-&gt;renderCategoriesMenuHtml($this-&gt;getSelectedCategoryId(), 0, 'level-top') ?&gt;
  &lt;?php
  if ($this-&gt;getTitle() != '') {
      $title = $this-&gt;getTitle();
  } else {
      $title = 'Categories';
  }
  ?&gt;
  &lt;?php
  $products = Mage::getModel('catalog/product')-&gt;getCollection()-&gt;addAttributeToSelect('*');
  ?&gt;
  &lt;?php if ($_menu): ?&gt;
          &lt;div class="block vertical-menu"&gt;   
              &lt;div class="title-block" style="margin-bottom:0px;"&gt;&lt;h4&gt;&lt;?php echo $this-&gt;__($title) ?&gt;&lt;/h4&gt;&lt;/div&gt;  
              &lt;div class="block-content"&gt;
                  &lt;?php $children = Mage::getModel('catalog/category')-&gt;getCategories(2);?&gt;
                  &lt;ul class="content-navigation"&gt;
                      &lt;?php foreach($children as $category){ ?&gt;
                      &lt;li&gt;
                      &lt;a href="&lt;?php echo $category-&gt;getUrlPath(); ?&gt;"&gt;&lt;?php echo $category-&gt;getName();?&gt;&lt;/a&gt;
                          &lt;? foreach($category-&gt;getId()){ ?&gt; // here I want to load product as per their category
                          &lt;ul&gt;
  
                          &lt;/ul&gt;
                          &lt;?php } ?&gt;
                      &lt;/li&gt;
                      &lt;?php } ?&gt;
                  &lt;/ul&gt;
              &lt;/div&gt;
          &lt;/div&gt;
  &lt;?php else: ?&gt;
      &lt;?php if (Mage::helper('mpanel')-&gt;acceptToUsePanel()): ?&gt;
          &lt;div class="block vertical-menu"&gt;   
              &lt;div class="block-title"&gt;&lt;strong&gt;&lt;span&gt;&lt;?php echo $this-&gt;__($title) ?&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;    
              &lt;div class="block-content"&gt;
                  &lt;p&gt;&lt;?php echo $this-&gt;__('Have no categories.'); ?&gt;&lt;/p&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;?php endif; ?&gt;
  &lt;?php endif; ?&gt;
  </code></pre>