Closed
Description
The pagination became incorrect. For example, The pagination would show 10 page when there are only 3 pages of product on product listing page.
Preconditions
Magento version 2.1.2
Steps to reproduce
- Create a frontend plugin for product collection's load function, beforeLoad()
- Add a new addAttributeToFitler() to $subject
- get the value of getSize()
Expected result
- the getSize() should reflect the total in the collection with new attribute filter.
Actual result
- the _totalRecords is not correct for filtered collection. getSize() returns incorrect value.
Investigation:
The total records was pulled from a different model. When I added new attribute filter to the collection, it did not update the search criteria in catalogsearch models. Hence, the total records did not represent the total in the collection.
Magento\CatalogSearch\Model\ResourceModel\Fulltext\Collection::_renderFiltersBefore()
Line 347: $this->_totalRecords = $this->searchResult->getTotalCount();
Metadata
Metadata
Assignees
Labels
The issue has been fixed in 2.2 release lineThe issue has been fixed in 2.3 release lineGate 2 Passed. Manual verification of the issue description passedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedGate 1 Passed. Automatic verification of issue format passedThe issue has been reproduced on latest 2.1 release