php - Add Pagination To Custom Magento catalog -


i have code, , need add pagination code.

function __construct() {          $category = mage::getmodel('catalog/category');         $products = mage::getresourcemodel('catalog/product_collection')                   ->addattributetoselect('name')                   ->addattributetoselect('price')                   ->addfinalprice()                   ->addattributetoselect('small_image')                   ->addattributetoselect('image')                   ->addattributetoselect('thumbnail')                   ->addurlrewrite()                   ->addcategoryfilter($category);         mage::getsingleton('catalog/product_visibility')->addvisibleincatalogfiltertocollection($products);         $currencycode = mage::app()->getstore()->getbasecurrencycode();         foreach($products $product){               echo $product->getid()."<br>";             echo $product->getname()."<br>";             echo mage::helper('core')->currency($product->getprice(), true, false)."<br>"; //." ".$currencycode,             echo $product->getproducturl()."<br>";             echo "<img src='".(string)mage::helper('catalog/image')->init($product, 'thumbnail')."' alt='product'><br><hr>";          }       }  

how can add pagination ? )


Comments

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

Nuget pack csproj using nuspec -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -