I need to get the current number of pages (if we are in a category) in head.phtml.
The line below doesn't help me because if a filter is applied, the total of pages must to change.
$prodCol = $category->getProductCollection()->addAttributeToFilter('status', 1)->addAttributeToFilter('visibility', array('in' => array(Mage_Catalog_Model_Product_Visibility::VISIBILITY_IN_CATALOG, Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH)));
$tool = $this->getLayout()->createBlock('page/html_pager')->setLimit($this->getLayout()->createBlock('catalog/product_list_toolbar')->getLimit())->setCollection($prodCol);
Can you help me?
Best Answer
You can get the current page number form url of that page.
Try below code
For eg :
here get parameter "p" is the current page number of the pagination