0

In Magento 2.4.x CE site noticed that category pages are displaying same content/products whenever a category has more than 2 pages. Basically pages 3, 4, and so on display page # 2 products. Tried clearing cache, re-index couple of times but still no clue. Doesn't appear to be related to a theme as disabling or changing to other didn't fix the issue. Products are not duplicated in the category based on the back-end data.

Any clues on how to debug this issue as I don't see any errors or messages in the logs.

Tested rest/default_1/V1/products?searchCriteria API endpoint with different category id's and results matches with admin panel numbers.

What other code or files I should check to debug this further or any other clues?

Doesn't appear to be indexing issue either, as I see same results even after running indexer:reindex couple of times.

Thanks

2
  • may be indexing issue? try to run bin/magento indexer:reindex command Commented Oct 25, 2021 at 5:08
  • Doesn't appear to the index issue, ran reindex too and it didn't resolve.
    – cnu
    Commented Oct 26, 2021 at 1:29

2 Answers 2

0

I think you have some customize on theme or code,

you can check these file, which is responsible for rendering category

Magento\Catalog\Block\Product\ListProduct
Magento_Catalog::product/list.phtml

also, check SQL by breaking out the debug on

Magento\Catalog\Block\Product\ListProduct::getLoadedProductCollection()->getSelect()->__toString()
2
  • When I echoed _productCollection in the list.phtml, I see current page count only. Any idea how to debug this in the server as I don't have working local environment?
    – cnu
    Commented Oct 26, 2021 at 2:10
  • Also I see following code in out of box ListProduct.php function. public function getLoadedProductCollection() { $collection = $this->_getProductCollection(); $categoryId = $this->getLayer()->getCurrentCategory()->getId(); foreach ($collection as $product) { $product->setData('category_id', $categoryId); } return $collection; }
    – cnu
    Commented Oct 26, 2021 at 2:11
0

Reverting to Magento default search engine(Elasticsearch7) has resolved the issue. Need to see why a 3rd party vendor extension for Elasticsearch is causing this issue.

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.