0

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.

3 Answers 3

1

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.

0

Go to app\design\frontend\base\default\template\page\html\pager.phtml and find: lines which contains $this->canShowFirst() and line $this->canShowLast().

Below them you will find html to edit to change

7
  • hi, thanks for your quick answer. But my pager doesn't show first and last. how can I activate this option first? Commented Jan 23, 2014 at 14:07
  • How many pages do you have? Commented Jan 23, 2014 at 14:15
  • You should see "go to the last" when you have more then 5 pages. Just check if you use app\design\frontend\base\default\template\page\html\pager.phtml. If you use your own template copy/paste the code with $this->canShowFirst() and line $this->canShowLast(). Commented Jan 23, 2014 at 14:24
  • In my category there are 9027 products. Here's a link: shop.maschinenring.de/produkte.html?manufacturer=702 I use the standard magento toolbar and pager template but I've copied it in my theme folder Commented Jan 23, 2014 at 14:42
  • Does your template contains if ($this->canShowFirst())? Commented Jan 23, 2014 at 14:49
0

For me the solution was to edit pager.phtml template file. Default template file is app\design\frontend\base\default\template\page\html\pager.phtml.

Find

<?php if ($this->canShowFirst()): ?>

and replace with

<?php if ($this->getFrameStart() > 1): ?>


Find

<?php if ($this-> canShowLast()): ?>

Replace with

<?php if ($this->getFrameEnd() < $this->getLastPageNum()): ?>


Now the first and last button will show when nedded.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.