title: Magento custom blocks
body: <p>I am trying to show the popular product list using ajax in magento on the home page using ajax, I could do that for 5 or "N" no.of products, but what i want is the pagination toolbar to be added with the result set.</p>
  
  <p>This is what i added to show the popular products,</p>
  
  <pre><code>// Magento layout
  $magento_block = Mage::getSingleton('core/layout');
  $productsHtml = $magento_block-&gt;createBlock('catalog/product');
  $productsHtml-&gt;setTemplate('catalog/product/popular.phtml');
  echo $productsHtml -&gt;toHTML();
  </code></pre>
  
  <p>And under popular.phtml</p>
  
  <pre><code>&lt;?php   
  
      $_productCollection = Mage::getModel('catalog/product')-&gt;getCollection()
      -&gt;addPriceData()
      -&gt;addAttributeToSort('ordered_qty', 'DESC')
      -&gt;addAttributeToSort('name', 'ASC')
      -&gt;setPageSize($limit)
      -&gt;setPage($p, $limit)       
      -&gt;addAttributeToSelect(array('entity_id', 'entity_type_id', 'attribute_set_id', 'type_id', 'sku', 'category_ids', 'created_at', 'updated_at','has_options', 'sync', 'name', 'stock_status', 'wc_review_iwc_rating', 'wc_review_wa_rating', 'wc_review_bh_rating', 'small_image', 'status', 'pre_arrival', 'description', 'short_description', 'price', 'is_salable', 'stock_item', 'gift_message_available', 'featured'));
  
  ?&gt;
  </code></pre>
  
  <p>So this gives me the popular products of specified page and limit, but i could not load the pagination toolbar(by directly adding the toolbar to <strong>popular.phtml</strong> or through create block layout function), Where am wrong? Could anybody tell me please.</p>
  
  <p>Thanks</p>