2

In template file Magento_Theme/templates/html/pager.phtml the following code is never displayed:

<?php if ($block->canShowPreviousJump()): ?>
    <li class="item">
        <a class="page previous jump" title="" href="<?= $block->getPreviousJumpUrl() ?>">
            <span>...</span>
        </a>
    </li>
<?php endif;?>
<?php if ($block->canShowNextJump()): ?>
    <li class="item">
        <a class="page next jump" title="" href="<?= $block->getNextJumpUrl() ?>">
            <span>...</span>
        </a>
    </li>
<?php endif;?>

I am testing this in a category that has 35 pages of listing products. I'm browsing random pages.

I have also tried changing Pagination Frame and Pagination Frame Skip in magento configuration.

How does pagination jump work? What should I do to make it visible?

10
  • Does pagination is override by any module or theme? Dec 23, 2019 at 13:35
  • Did you try expecting the element? THe code is visible but hidden? Or the code is not loaded at all? Can you provide URL? Dec 23, 2019 at 23:43
  • @GerardoSiano the if clause returns false, so the jump html code is not displayed at all. If I remove if form the code, the jump html is displayed but not working. getPreviousJumpUrl() is null
    – zekia
    Dec 24, 2019 at 7:12
  • @zekia, can you please check that in theme or extension? Did you remove the pagination from XML? <referenceBlock name="product_list_toolbar_pager" remove="true" /> Dec 24, 2019 at 9:18
  • @Kushal no theme or extension is not making any change on pagination. I have not removed pagination by xml. Pagination is displayed. The "jump" thing is not working.
    – zekia
    Dec 24, 2019 at 9:23

2 Answers 2

1

What version of 2.3 are you on? 2.3.3 has a bug if you're using trailing slash / instead of a .html prefix is causing queries not to run. They apparently are actively working on a solution. 2.3.2-p2 is not experiencing this. Hopefully this will be fixed in 2.3.4 if they can agree on a fix:

https://github.com/magento/magento2/issues/18717

https://github.com/magento/magento2/pull/25603

2
  • I'm using 2.3.0 but I'll check the links anyway
    – zekia
    Dec 20, 2019 at 9:16
  • I don't think that this bug is related to my issue because I don't use / at the end of category list pages urls. I have category?p=4 links
    – zekia
    Dec 20, 2019 at 9:21
0

I didn't find any solution to this so I created a custom pager.phtml file, with the following changes:

<?php
if(isset($_GET["p"])){
    $current_page = $_GET["p"];
}else{
    $current_page = 1;
}
$last_page = $this->getLastPageNum();
$nextJumpLimit = $last_page-2;
$previousJumpLimit = 3;
$previousJump = 0;
$nextJump = 0;
if($current_page > $previousJumpLimit){
    $previousJump = 1;
}
if($current_page < $nextJumpLimit){
    $nextJump = 1;
}
?>

<?php if ($previousJump == 1): ?>
    <li class="item">
        <a class="page previous_jump" title="" href="<?php echo $block->getPageUrl($current_page-2); ?>">
            <span>...</span>
        </a>
    </li>
<?php endif; ?>

<?php if ($nextJump == 1): ?>
    <li class="item">
        <a class="page next_jump" title="" href="<?php echo $block->getPageUrl($current_page+2); ?>">
            <span>...</span>
        </a>
    </li>
<?php endif; ?>

I'm posting this here, in case it helps somebody out there.

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.