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.
5 Answers
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 ... Commented Jul 3, 2013 at 11:23
-
1Good to know. If the answer solved your problem, mark it as accepted. Don't leave loose ends. :)– Marius ♦Commented Jul 3, 2013 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 ? Commented Mar 25, 2014 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 ♦Commented Mar 25, 2014 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: DisplayShow Items
on top andPagination
at bottom on prod listing page Commented May 1, 2014 at 8:34
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.– AshCommented Aug 14, 2014 at 11:58
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() ?>
If you want to remove pagination from grid then you can do this
protected function _prepareLayout()
{
$this->setPagerVisibility(false);
return parent::_prepareLayout();
}
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>
System > Configuration > Developer > Add Template Hints
? That might give you a clue where to start from