Skip to content

Commit 1b27d8d

Browse files
committed
Fix calculating correct total records of admin grids in Magento 2.4.0. Fixes #11
1 parent 2aa2dd6 commit 1b27d8d

File tree

4 files changed

+16
-0
lines changed

4 files changed

+16
-0
lines changed

Model/ResourceModel/Catalog/Category/UrlKeyCollection.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@ public function loadData($printQuery = false, $logQuery = false)
5959

6060
$this->_setIsLoaded();
6161

62+
// fill $this->_totalRecords by calling getSize
63+
// if we don't do this and leave this up to Magento, it will do it too late in Magento 2.4.x
64+
$this->getSize();
65+
6266
// page the data, need to do this after setting the data as loaded,
6367
// otherwise the getCurPage would create a recursive problem
6468
$startIndex = ($this->getCurPage() - 1) * $this->getPageSize();

Model/ResourceModel/Catalog/Category/UrlPathCollection.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@ public function loadData($printQuery = false, $logQuery = false)
5959

6060
$this->_setIsLoaded();
6161

62+
// fill $this->_totalRecords by calling getSize
63+
// if we don't do this and leave this up to Magento, it will do it too late in Magento 2.4.x
64+
$this->getSize();
65+
6266
// page the data, need to do this after setting the data as loaded,
6367
// otherwise the getCurPage would create a recursive problem
6468
$startIndex = ($this->getCurPage() - 1) * $this->getPageSize();

Model/ResourceModel/Catalog/Product/UrlKeyCollection.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@ public function loadData($printQuery = false, $logQuery = false)
5959

6060
$this->_setIsLoaded();
6161

62+
// fill $this->_totalRecords by calling getSize
63+
// if we don't do this and leave this up to Magento, it will do it too late in Magento 2.4.x
64+
$this->getSize();
65+
6266
// page the data, need to do this after setting the data as loaded,
6367
// otherwise the getCurPage would create a recursive problem
6468
$startIndex = ($this->getCurPage() - 1) * $this->getPageSize();

Model/ResourceModel/Catalog/Product/UrlPathCollection.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@ public function loadData($printQuery = false, $logQuery = false)
5959

6060
$this->_setIsLoaded();
6161

62+
// fill $this->_totalRecords by calling getSize
63+
// if we don't do this and leave this up to Magento, it will do it too late in Magento 2.4.x
64+
$this->getSize();
65+
6266
// page the data, need to do this after setting the data as loaded,
6367
// otherwise the getCurPage would create a recursive problem
6468
$startIndex = ($this->getCurPage() - 1) * $this->getPageSize();

0 commit comments

Comments
 (0)