How to fix the Magento 2.4.5 Layered Navigation showing incorrect results issue?
After upgrading Magento to version 2.4.5 you can see the error:
TypeError: Magento\Elasticsearch\Model\ResourceModel\Fulltext\Collection\SearchResultApplier::categoryProductByCustomSortOrder(): Argument #1 ($categoryId) must be of type int, array given
Moreover, in Magento 2.4.5, if you have Display Out of Stock Products setting enabled, the layered navigation will not work correctly.
This bug is related to recent Magento changes and affects custom extensions such as Amasty Improved Layered Navigation.
How to fix the Magento 2.4.5 issue with Layered Navigation?
Magento appears to fix this bug only in the next release, but you don't have to wait for their update because we have already developed a free fixpack to resolve this issue.
If you are an 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.
Related Articles
How to resolve the "Please select brand attribute in Stores → Configuration → Amasty Extensions → Improved Layered Navigation: Brands." frontend error?
The message “Please select brand attribute in Stores → Configuration → Amasty Extensions → Improved Layered Navigation: Brands” appearing on your All Brands Page indicates that additional configuration is required to display the brands on the ...
How to disable Improved Layered Navigation on a specific store?
For multistore installations, this option is not covered. Although the settings for the Improved Layered Navigation module can be configured individually for each store view, the module cannot be disabled on a store view basis.
Meta data for filters is not applied, is there a fix for it?
The extension allows changing some page properties like title, description, images, and CMS blocks, including some Meta data, when applying a filter. The feature requires configuration described below. Step 1. In the general extension settings ...
Configured expand logic doesn’t work on the frontend. How to fix?
Improved Layered Navigation provides the flexibility to set the filters to either be expanded or collapsed when the page is loaded, and this option can be set independently for different devices. There are three available options: Auto — usually, ...
How to add brands to your e-store?
There are 3 crucial steps to be followed for adding the brand to the e-store: Step 1. A new attribute should be created in Product → Attributes. Step 2. The attribute should be added to the products. Step 3. It is necessary to set the created ...