1

Having trouble removing the pager from the category pages within Magento 2. I extended the catalog module and placed the removal reference inside catalog_category_view.xml. This however does not work, any help is appreciated.

<referenceBlock name="product_list_toolbar_pager" remove="true"/>

3 Answers 3

1

Add default.xml in any of your custom module with following code. It will remove pager.

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceBlock name="product_list_toolbar_pager" remove="true" />
    </body>
</page>
2
  • This removes the toolbar from all pages. Feb 24, 2016 at 19:26
  • How we can remove only "Limiter" from pagination pdp in magento 2? Jan 16, 2018 at 5:30
0

Not sure this is the best solution but I copied toolbar.phtml to my module and just commented them out.

0

In this answer I'm using Magento 2.1.7, so this answer could be modified later. I have tried first with the layout solution using xml but without success. enter image description here I managed to remove the pager from the toolbar in category page by overriding the following file:

vendor/magento/module-catalog/view/frontend/templates/product/list/toolbar.phtml

To do so, inside your Theme folder add the following folder architecture:

Magento_Catalog/templates/product/list

Then copy/past the toolbar.phtml into it, you can remove the pager by commenting line number: 31 like the following:

<?php
/**
 * Copyright © 2013-2017 Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */

// @codingStandardsIgnoreFile

?>
<?php
/**
 * Product list toolbar
 *
 * @var $block \Magento\Catalog\Block\Product\ProductList\Toolbar
 */
use Magento\Catalog\Model\Product\ProductList\Toolbar;
?>
<?php if ($block->getCollection()->getSize()): ?>
    <div class="toolbar toolbar-products" data-mage-init='<?php /* @escapeNotVerified */ echo $block->getWidgetOptionsJson(); ?>'>
        <?php if ($block->isExpanded()): ?>
            <?php include ($block->getTemplateFile('Magento_Catalog::product/list/toolbar/viewmode.phtml')) ?>
        <?php endif; ?>

        <?php  include ($block->getTemplateFile('Magento_Catalog::product/list/toolbar/amount.phtml')) ?>

        <?php  echo $block->getPagerHtml() ?>

        <?php  include ($block->getTemplateFile('Magento_Catalog::product/list/toolbar/limiter.phtml')) ?>

        <?php if ($block->isExpanded()): ?>
            <?php // include ($block->getTemplateFile('Magento_Catalog::product/list/toolbar/sorter.phtml')) ?>
        <?php endif; ?>
    </div>
<?php endif ?>

As you can see there is a comment in this line:

        <?php // include ($block->getTemplateFile('Magento_Catalog::product/list/toolbar/sorter.phtml')) ?>

After removing the cache I have now the pager removed in category page. enter image description here

Your Answer

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

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