Magento – PAGINATION : Show First and Last Page at pager / toolbar grid view

magento-1pagertoolbar

at the moment my pager at grid view is like this " 1 2 3 4 5 >" on page 5 it's "< 5 6 7 8 9 >". See Screenshot

How can I edit my pager.phtml template to get a result like this : " 1 2 3 4 5 Last >" or "First < 5 6 7 8 9 > Last"

I want to show the first and last page on my pager.

Best Answer

For me the solution was to dig in the code and find where and why the canShowFirst() and canShowLast() logic was failing

Mage_Catalog_Block_Product_List_Toolbar on line 815:

    $pagerBlock->setUseContainer(false)
        ->setShowPerPage(false)
        ->setShowAmounts(false)
        ->setLimitVarName($this->getLimitVarName())
        ->setPageVarName($this->getPageVarName())
        ->setLimit($this->getLimit())
        ->setFrameLength(Mage::getStoreConfig('design/pagination/pagination_frame'))
        ->setJump(Mage::getStoreConfig('design/pagination/pagination_frame_skip'))
        ->setCollection($this->getCollection());

setJump() was using an admin setting in System > Config > General > Design > Pagination. 'pagination_frame_skip' was empty, but when i echoed it in pager.phtml it gave a value of 0. Seems like the core code should check the value of the store config before setting the jump, but that neither here nor there. I set the value in the admin to 5(which is the default setting in Mage_Page_Block_Html_Pager, but Mage_Catalog_Block_Product_List_Toolbar was overriding it) and all the canShow logic was now working as expected.