bluvertigo
5/24/2016 - 8:45 AM

pagination

pagination

<?php
$product_collection = clone Mage::getSingleton('catalog/layer')->getProductCollection(); 
    $total = count($product_collection);

    $current_page = Mage::getBlockSingleton('page/html_pager')->getCurrentPage();

    $limit = Mage::getSingleton('core/app')->getRequest()->getParam('limit');
    if(empty($limit))
    {
        $limit = Mage::getStoreConfig('catalog/frontend/grid_per_page');
    }

    $pages = $total / $limit;
    $pages = ceil($pages);

    if($current_page > 1)
    {
        $page_info = "Page " . $current_page . " of $pages for ";
    }

    $FirstNum = $limit*($current_page-1)+1;

    if($current_page == $pages)
    {
        $LastNum = $total;
    }
    else
    {
        $LastNum = $limit + ($FirstNum - 1);
    }

    $items_info = "Listings " . $FirstNum . "-" . $LastNum . " (out of ". $total . ") ";