1

Can anyone have faced the below error while opening the product listing page at the storefront?

After upgrade magento version 2.4.3 to 2.4.5 I am facing.

1 exception(s): Exception #0 (Exception): Notice: Object of class Magento\Framework\Phrase could not be converted to int in /home/public_html/website/vendor/magento/module-catalog/view/frontend/templates/product/list/toolbar/limiter.phtml on line 26

1 Answer 1

0

You have to override vendor/magento/module-catalog/view/frontend/templates/product/list/toolbar/limiter.phtml in your custom theme.

Then create a file inside your theme app/design/frontend/VendorName/ThemeName/Magento_Catalog/templates/product/list/toolbar/limiter.phtml

Add below code to the file

<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
?>
<?php
/**
 * Product list toolbar
 *
 * @var \Magento\Catalog\Block\Product\ProductList\Toolbar $block
 * @var \Magento\Framework\Locale\LocaleFormatter $localeFormatter
 */
?>
<div class="field limiter">
    <label class="label" for="limiter">
        <span><?= $block->escapeHtml(__('Show')) ?></span>
    </label>
    <div class="control">
        <select id="limiter" data-role="limiter" class="limiter-options">
            <?php foreach ($block->getAvailableLimit() as $_key => $_limit):?>
                <option value="<?= $block->escapeHtmlAttr($_key) ?>"
                    <?php if ($block->isLimitCurrent($_key)):?>
                        selected="selected"
                    <?php endif ?>>
                    <?= $block->escapeHtml(
                        is_numeric($_limit) ? $localeFormatter->formatNumber((int) $_limit) : $_limit
                    ) ?>
                </option>
            <?php endforeach; ?>
        </select>
    </div>
    <span class="limiter-text"><?= $block->escapeHtml(__('per page')) ?></span>
</div>

Your Answer

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

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