Skip to content

Commit 69f37c2

Browse files
committed
MC-30183: ES6.0+ Display all products on page
- checking the available page number comparing with the total pages for catalog products. Display the products with the correct pagination
1 parent fed8e75 commit 69f37c2

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

app/code/Magento/Elasticsearch/Model/ResourceModel/Fulltext/Collection/SearchResultApplier.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ public function apply()
8585
private function sliceItems(array $items, int $size, int $currentPage): array
8686
{
8787
if ($size !== 0) {
88+
$totalPages = (int) ceil(count($items)/$size);
89+
$currentPage = min($currentPage, $totalPages);
8890
$offset = ($currentPage - 1) * $size;
8991
if ($offset < 0) {
9092
$offset = 0;

0 commit comments

Comments
 (0)