I am unable to see paging on my category view products. By default 12 products show and when I add a query string ?p=2 then other page products show.
I have checked the file. app/design/frontend/theme_vendor/theme_name/Magento_Catalog/templates/product/list.phtml
these two methods also exist responsible to print paging
<?= $block->getToolbarHtml() ?>
<?= $block->getAdditionalHtml() ?> Admin Panel Setting.
Hello @ishaqdahot
I have resolved the issue partially in my
/vendor/magento/module-catalog/view/frontend/templates/product/list/toolbar/phtml
below condition was not working
if ($block->getCollection()->getSize()) :
So I replaced it with
if (count($block->getCollection())) :
Now the page looks like this. As you can see showing 0 items in
Top:
Bottom of page:
In Magento Open Source 2.4.3 I used below and it worked.
<?= $block->getChildBlock('toolbar')->setIsBottom(true)->toHtml() ?>
File Path: 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.
Source Reference: https://magento.stackexchange.com/questions/345102/after-upgrading-to-magento-2-4-3-the-pagination-i...
If anyone else comes accross this in their google search this is the fix:
Apparently the bug is in Magento\Elasticsearch7\SearchAdapter\Adapter
When returning the results for the search query, this is the code that returns the total :
$queryResponse = $this->responseFactory->create(
[
'documents' => $rawDocuments,
'aggregations' => $aggregationBuilder->build($request, $rawResponse),
'total' => $rawResponse['hits']['total']['value'] ?? 0
]
);But the $rawResponse['hits']['total'] is not an array, it contains the value directly:
Array
(
[took] => 2
[timed_out] =>
[_shards] => Array
(
[total] => 5
[successful] => 5
[skipped] => 0
[failed] => 0
)
[hits] => Array
(
[total] => 25
[max_score] =>
[hits] => Array
(
[0] => Array
(
[_index] => magento2_product_1_v49
[_type] => document
[_id] => 1874
[_score] =>
[sort] => Array
(
[0] => 10000
)
)
etcAs soon as I change the total to: 'total' => $rawResponse['hits']['total'] ?? 0 everything works correctly (pagination, getSize,
Original link https://github.com/magento/magento2/issues/29777
Thanks for sharing this.