4

After upgrading from Magento 2.4.2-p1 to 2.4.3 the pagination is not showing up anymore on category and search result pages. I tested disabling the Magento 2 Infinite Scroll extension from Weltpixel because I thought maybe it's not compatible yet with 2.4.3 but it is still not working. Also, I tried to use the default Luma theme for a store view where the pagination is not showing up either.

If I add ?p=2 to the category page URL, the products of the second page are loading but the pagination is still not visible.

Also sometimes I am getting this message. Not sure if related. loader.js:210 Expected to start loader but did not find one in the dom

Line 210 shows this:

 if (window.console && !ctx.parents('[data-role="loader"]').length) {
                    console.warn('Expected to start loader but did not find one in the dom');
                }
1
  • So I downgraded to 2.4.2-p2 and now the pagination is working fine again. My guess is something with the theme or it's extensions is not working (Weltpixel Pearl Pro) or probably another third party extension. Aug 25, 2021 at 10:42

6 Answers 6

17

I found the problem to exist in my overide file app/design/frontend/Vendor/Theme/Magento_Catalog/templates/product/list.phtml

The original code in the bottom section of the page looked like this:

<?= $block->getToolbarHtml() ?>

but it has since been changed to this in the recent update:

<?= $block->getChildBlock('toolbar')->setIsBottom(true)->toHtml() ?>

On switching the code to the new version, the pagination started showing again in the catalog pages.

2

OK, so I have done a little experimenting. I've amended the 2.4.3 toolbar.phtml code to include the missing 2 elements in the else statement (seemed like a logical thing to have included, just in case the bottom block is missing in the theme - kind of reverting back to similar to 2.3). I assume it's been changed for a reason, if anyone can enlighten me on that one?

It now displays the limiter on page load, however it's showing all the products in the category or search results (lazy load helps here). If you then choose a limit number from the dropdown, the pagination works as expected and the page numbers appear at the bottom - yey!!

This fix is for the desktop view, the mobile will still show the max items as the limiter is hidden by CSS. I suppose it could be styled to show if you really wanted to.

I'm almost certain this was the default behaviour when I first installed 2.4.1 and then changed it to show only 12 per page, but I don't remember how to get it back.

Anyway, hope this helps others out.

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

<?php if ($block->getCollection()->getSize()) :?>
    <?php $widget = $this->helper(\Magento\Framework\Json\Helper\Data::class)->jsonDecode($block->getWidgetOptionsJson());
        $widgetOptions = $this->helper(\Magento\Framework\Json\Helper\Data::class)->jsonEncode($widget['productListToolbarForm']);
    ?>
    <div class="toolbar toolbar-products" data-mage-init='{"productListToolbarForm":<?= /* @noEscape */ $widgetOptions ?>}'>
        <?php if ($block->getIsBottom()): ?>
            <?= $block->getPagerHtml() ?>
            <?= $block->fetchView($block->getTemplateFile('Magento_Catalog::product/list/toolbar/limiter.phtml')) ?>
        <?php else: ?>
            <?php if ($block->isExpanded()): ?>
                <?= $block->fetchView($block->getTemplateFile('Magento_Catalog::product/list/toolbar/viewmode.phtml')) ?>
            <?php endif ?>
            <?= $block->fetchView($block->getTemplateFile('Magento_Catalog::product/list/toolbar/amount.phtml')) ?>
            <?= $block->getPagerHtml() ?>
            <?= $block->fetchView($block->getTemplateFile('Magento_Catalog::product/list/toolbar/limiter.phtml')) ?>
            <?php if ($block->isExpanded()): ?>
                <?= $block->fetchView($block->getTemplateFile('Magento_Catalog::product/list/toolbar/sorter.phtml')) ?>
            <?php endif ?>
        <?php endif ?>
    </div>
<?php endif ?>
1
  • this fix working too in 2.4.4 with custom theme enabled, thank you Apr 27 at 11:02
1

Solution by Chris in chain above worked for me. I was using the "Ultimo" theme which is a few years old now, on a 2.4.3-p1 install.

I found my theme's overload of the list.phtml file:

vendor/.../Magento_Catalog/templates/product/list.phtml

In that file, this line of code is mentioned twice:

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

Change both lines to:

<?= $block->getChildBlock('toolbar')->setIsBottom(true)->toHtml() ?>

Clear view_preprocessed:

rm ./var/view_preprocessed/pub/static/.../list.phtml

Clear cache, hard reload and problem is fixed.

0

You need to do this thing.

  1. Do the Upgrade with the composer Method.

  2. Try to disable all third-party extensions and then check, so we get the idea issue is from any extension or not.

  3. Try to change the theme with the default luma theme, so get the idea issue is related to the theme or not.

3
  • Hello thank you for the recommendations. I think it is indeed the best idea to test the issue will all third party extensions disabled to find out which one is causing the problem. It might be something with the theme as well. So I will find out hopefully. Aug 25, 2021 at 11:28
  • You can check in that way. If above answer help then upvote and accept as solution so it will help other in community. Aug 25, 2021 at 12:50
  • I found out that the theme I am using is causing the problems. Until they are releasing an update I am staying on version 2.4.2-p2 Aug 27, 2021 at 11:45
0

@cookie monster what theme are you using? We have the same issue with ArrowHiTech's Claue. I've upgraded it to the latest, which is supposed to be 2.4.3 compatible, but that hasn't helped. I'm sure it's an issue with the 2.4.3 update

3
  • I am using the WeltPixel Pearl theme but I had to downgrade to 2.4.2-p2 until they are releasing an update making it compatible with 2.4.3. Sep 2, 2021 at 8:04
  • My theme doesn't look like it's affecting this, but I had noticed that the toolbar.phtml file has been altered in 2.4.3. It's now referencing $block->getIsBottom(), is this the issue?
    – DPCO
    Sep 4, 2021 at 11:56
  • Most likely, I did not check because they released a new version which is working now Sep 6, 2021 at 8:00
-1

Use to below code to display pagination above Magento 2.4.X version.

<?= $block->getChildBlock('toolbar')->setIsBottom(true)->toHtml() ?>

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.