Magento 2.4.5 the layered navigation doesn't work correctly (from Amasty)

You may have noticed that in Magento 2.4.5 the layered navigation doesn’t work correctly.

Preconditions and environment

  • Magento 2.4.5 CE
  • PHP 8.1.9
  • Elasticsearch 7.17.0-7.17.5
  • Fill Elasticsearch with data
  • Go to category page

Steps to reproduce

  • Run Catalog Search Indexer “bin/magento indexer:reindex catalogsearch_fulltext”
  • Go to category page

Expected result

  • Products shown on the list page

Actual result

TypeError: Magento\Elasticsearch\Model\ResourceModel\Fulltext\Collection\SearchResultApplier::categoryProductByCustomSortOrder(): Argument #1 ($categoryId) must be of type int, array given, called in /var/www/php/folder/vendor/magento/module-elasticsearch/Model/ResourceModel/Fulltext/Collection/SearchResultApplier.php on line 191 and defined in /var/www/php/folder/vendor/magento/module-elasticsearch/Model/ResourceModel/Fulltext/Collection/SearchResultApplier.php:209

This bug is related to recent Magento changes and affects custom extensions from different vendors.

Reference: Magento 2.4.5: TypeError: Magento\Elasticsearch\Model\ResourceModel\Fulltext\Collection\SearchResultApplier::categoryProductByCustomSortOrder(): Argument #1 ($categoryId) must be of type int, array given, · Issue #35918 · magento/magento2 · GitHub

Here’s the way to fix it:

Magento appears to fix this bug only in the next release, but you don’t have to wait for them to fix it – we’ve developed a free fixpack so that you can handle the issue.

If you are Amasty customer, you can fix this error by installing additional package from our private repository:

composer require amasty/module-mage-2.4.5-fix

But this case can be reproduced without our extension. This is why we made the package public.

Referece: Fixing the Magento 2.4.5 Layered Navigation Showing Incorrect Results Issue

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.