2

How can I remove the "pager" above the Product-Grid Page catalog/view.phtml from "toolbar"? I need the sorter above and below the products, but the "pager" only at page-bottom. It must be in catalog.xml ... I don't know it exactly.

  • Did you check what phtml file the pager is called from using System > Configuration > Developer > Add Template Hints? That might give you a clue where to start from – Sander Mangel Jul 3 '13 at 8:35
17

You can do this by modifying catalog/product/list.phtml and catalog/prodct/list/toolbar.phtml from your theme.

First, the changes in catalog/product/list/toolbar.phtml.
Wrap the div with class pager in this if statement (the full div element not just the tag opening line):

<?php if (!$this->getHidePager()) : ?>
   <!-- <div class="pager"> here -->
<?php endif;?>

now in catalog/product/list.phtml replace this line at the top of the file:

<?php echo $this->getToolbarHtml() ?>

with this one:

<?php echo $this->getToolbarBlock()->setHidePager(true)->toHtml();?>

and the same line at the bottom of the file with this one:

<?php echo $this->getToolbarBlock()->setHidePager(false)->toHtml();?>
  • It worked perfect. Thank you very much! For a Newbie it's hard to understand the 'Magento Way' to edit all of these files ... – user2310852 Jul 3 '13 at 11:23
  • 1
    Good to know. If the answer solved your problem, mark it as accepted. Don't leave loose ends. :) – Marius Jul 3 '13 at 11:40
  • @Marius cant get better than the way you specified. Answer upvoted. Can you explain the code a bit and is it possible to do the same through our layout xml file ? – Slimshadddyyy Mar 25 '14 at 9:20
  • 1
    @Vikram I don't know if it's possible through the layout file since the code changes a property of a block twice in the same template. Code explanation. When showing the toolbar first, you set a property 'hide_pager' to true. In the pager html it is checked if the property 'hide_pager' is set to true. If it is, then the pager is not displayed. The second time you show the pager, the property is set to false and the block is rendered again. – Marius Mar 25 '14 at 9:24
  • 1
    @Marius out of curiosity how can we show <div class"limiter"></div> on top and <div class="pages"></div> at the bottom of the product listing page without showing both together For ex: Display Show Items on top and Pagination at bottom on prod listing page – Slimshadddyyy May 1 '14 at 8:34
3

Another way to change top toolbar template from product listing replace below code: Instead of:

<?php echo $this->getToolbarHtml() ?>

We can add this:

 <?php echo  $this->getToolbarBlock()->setTemplate('catalog/product/list/toolbar-top.phtml')->toHtml(); ?>

Create new template as toolbar-top.phtml and comment pager code snippet.

  • (p.s. i know its old, just refining the answer with my thoughts) - Commenting code is usually a bad idea because it should be versioned, just delete it. Although I still think Marius offers the best and most appropriate solution. – ash Aug 14 '14 at 11:58
1

Also you can remove the pager within the toolbar.phtml, and in list.phtml after the product list, calls just the pager block with <?php echo $this->getToolbarBlock()->getPagerHtml() ?>

-1

In your local.xml add the following...

<catalog_category_default>
    <!-- Remove Toolbar by setting a blank template -->
    <reference name="product_list_toolbar">
        <action method="setTemplate"><template /></action>
    </reference>
</catalog_category_default>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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