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

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

ERROR:

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 Stack trace: #0 /var/www/php/folder/vendor/magento/module-elasticsearch/Model/ResourceModel/Fulltext/Collection/SearchResultApplier.php(191): Magento\Elasticsearch\Model\ResourceModel\Fulltext\Collection\SearchResultApplier->categoryProductByCustomSortOrder(Array) #1 /var/www/php/folder/vendor/magento/module-elasticsearch/Model/ResourceModel/Fulltext/Collection/SearchResultApplier.php(108): Magento\Elasticsearch\Model\ResourceModel\Fulltext\Collection\SearchResultApplier->getProductIdsBySaleability() #2 /var/www/php/folder/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Elasticsearch\Model\ResourceModel\Fulltext\Collection\SearchResultApplier->apply() #3 /var/www/php/folder/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Elasticsearch\Model\ResourceModel\Fulltext\Collection\SearchResultApplier\Interceptor->___callParent('apply', Array) #4 /var/www/php/folder/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Elasticsearch\Model\ResourceModel\Fulltext\Collection\SearchResultApplier\Interceptor->Magento\Framework\Interception\{closure}() #5 /var/www/php/folder/generated/code/Magento/Elasticsearch/Model/ResourceModel/Fulltext/Collection/SearchResultApplier/Interceptor.php(23): Magento\Elasticsearch\Model\ResourceModel\Fulltext\Collection\SearchResultApplier\Interceptor->___callPlugins('apply', Array, Array) #6 /var/www/php/folder/vendor/amasty/shopby/Model/ResourceModel/Fulltext/Collection.php(251): Magento\Elasticsearch\Model\ResourceModel\Fulltext\Collection\SearchResultApplier\Interceptor->apply() #7 /var/www/php/folder/vendor/magento/framework/Data/Collection/AbstractDb.php(343): Amasty\Shopby\Model\ResourceModel\Fulltext\Collection->_renderFiltersBefore() #8 /var/www/php/folder/vendor/amasty/shopby/Model/ResourceModel/Fulltext/Collection.php(401): Magento\Framework\Data\Collection\AbstractDb->_renderFilters() #9 /var/www/php/folder/vendor/magento/module-eav/Model/Entity/Collection/AbstractCollection.php(929): Amasty\Shopby\Model\ResourceModel\Fulltext\Collection->_renderFilters() #10 /var/www/php/folder/vendor/magento/module-catalog/Model/ResourceModel/Product/Collection.php(801): Magento\Eav\Model\Entity\Collection\AbstractCollection->load(false, false) #11 /var/www/php/folder/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Catalog\Model\ResourceModel\Product\Collection->load(false, false) #12 /var/www/php/folder/vendor/magento/framework/Interception/Interceptor.php(138): Amasty\Shopby\Model\ResourceModel\Fulltext\Collection\Interceptor->___callParent('load', Array) #13 /var/www/php/folder/vendor/magento/framework/Interception/Interceptor.php(153): Amasty\Shopby\Model\ResourceModel\Fulltext\Collection\Interceptor->Magento\Framework\Interception\{closure}() #14 /var/www/php/folder/generated/code/Amasty/Shopby/Model/ResourceModel/Fulltext/Collection/Interceptor.php(50): Amasty\Shopby\Model\ResourceModel\Fulltext\Collection\Interceptor->___callPlugins('load', Array, Array) #15 /var/www/php/folder/vendor/magento/module-catalog/Block/Product/ListProduct.php(199): Amasty\Shopby\Model\ResourceModel\Fulltext\Collection\Interceptor->load() #16 /var/www/php/folder/vendor/magento/framework/View/Element/AbstractBlock.php(1094): Magento\Catalog\Block\Product\ListProduct->_beforeToHtml() #17 /var/www/php/folder/vendor/magento/framework/View/Element/AbstractBlock.php(1099): Magento\Framework\View\Element\AbstractBlock->Magento\Framework\View\Element\{closure}() #18 /var/www/php/folder/vendor/magento/framework/View/Element/AbstractBlock.php(660): Magento\Framework\View\Element\AbstractBlock->_loadCache() #19 /var/www/php/folder/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Framework\View\Element\AbstractBlock->toHtml() #20 /var/www/php/folder/vendor/magento/framework/Interception/Interceptor.php(138): Vendor\Catalog\Block\Product\ListProduct\Interceptor->___callParent('toHtml', Array) #21 /var/www/php/folder/vendor/magento/framework/Interception/Interceptor.php(153): Vendor\Catalog\Block\Product\ListProduct\Interceptor->Magento\Framework\Interception\{closure}() #22 /var/www/php/folder/generated/code/Vendor/Catalog/Block/Product/ListProduct/Interceptor.php(59): Vendor\Catalog\Block\Product\ListProduct\Interceptor->___callPlugins('toHtml', Array, Array) #23 /var/www/php/folder/vendor/magento/framework/View/Layout.php(578): Vendor\Catalog\Block\Product\ListProduct\Interceptor->toHtml() #24 /var/www/php/folder/vendor/magento/framework/View/Layout.php(555): Magento\Framework\View\Layout->_renderBlock('category.produc...') #25 /var/www/php/folder/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Framework\View\Layout->renderNonCachedElement('category.produc...') #26 /var/www/php/folder/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\View\Layout\Interceptor->___callParent('renderNonCached...', Array) #27 /var/www/php/folder/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Framework\View\Layout\Interceptor->Magento\Framework\Interception\{closure}('category.produc...') #28 /var/www/php/folder/generated/code/Magento/Framework/View/Layout/Interceptor.php(41): Magento\Framework\View\Layout\Interceptor->___callPlugins('renderNonCached...', Array, Array) #29 /var/www/php/folder/vendor/magento/framework/View/Layout.php(510): Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('category.produc...') #30 /var/www/php/folder/vendor/magento/framework/View/Element/AbstractBlock.php(507): Magento\Framework\View\Layout->renderElement('category.produc...', true) #31 /var/www/php/folder/vendor/magento/module-catalog/Block/Category/View.php(100): Magento\Framework\View\Element\AbstractBlock->getChildHtml('product_list') #32 /var/www/php/folder/vendor/magento/module-catalog/view/frontend/templates/category/products.phtml(15): Magento\Catalog\Block\Category\View->getProductListHtml() #33 /var/www/php/folder/vendor/magento/framework/View/TemplateEngine/Php.php(71): include('/var/www/php/mo...') #34 /var/www/php/folder/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Framework\View\TemplateEngine\Php->render(Object(Magento\Catalog\Block\Category\View\Interceptor), '/var/www/php/mo...', Array) #35 /var/www/php/folder/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\View\TemplateEngine\Php\Interceptor->___callParent('render', Array) #36 /var/www/php/folder/vendor/amasty/module-fpc-warmer/Plugin/Holepunch/TemplateRenderer.php(57): Magento\Framework\View\TemplateEngine\Php\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Catalog\Block\Category\View\Interceptor), '/var/www/php/mo...', Array) #37 /var/www/php/folder/vendor/magento/framework/Interception/Interceptor.php(135): Amasty\Fpc\Plugin\Holepunch\TemplateRenderer->aroundRender(Object(Magento\Framework\View\TemplateEngine\Php\Interceptor), Object(Closure), Object(Magento\Catalog\Block\Category\View\Interceptor), '/var/www/php/mo...', Array) #38 /var/www/php/folder/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Framework\View\TemplateEngine\Php\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Catalog\Block\Category\View\Interceptor), '/var/www/php/mo...', Array) #39 /var/www/php/folder/generated/code/Magento/Framework/View/TemplateEngine/Php/Interceptor.php(23): Magento\Framework\View\TemplateEngine\Php\Interceptor->___callPlugins('render', Array, Array) #40 /var/www/php/folder/vendor/magento/framework/View/Element/Template.php(263): Magento\Framework\View\TemplateEngine\Php\Interceptor->render(Object(Magento\Catalog\Block\Category\View\Interceptor), '/var/www/php/mo...', Array) #41 /var/www/php/folder/vendor/magento/framework/View/Element/Template.php(293): Magento\Framework\View\Element\Template->fetchView('/var/www/php/mo...') #42 /var/www/php/folder/vendor/magento/framework/View/Element/AbstractBlock.php(1095): Magento\Framework\View\Element\Template->_toHtml() #43 /var/www/php/folder/vendor/magento/framework/View/Element/AbstractBlock.php(1099): Magento\Framework\View\Element\AbstractBlock->Magento\Framework\View\Element\{closure}() #44 /var/www/php/folder/vendor/magento/framework/View/Element/AbstractBlock.php(660): Magento\Framework\View\Element\AbstractBlock->_loadCache() #45 /var/www/php/folder/vendor/magento/framework/View/Layout.php(578): Magento\Framework\View\Element\AbstractBlock->toHtml() #46 /var/www/php/folder/vendor/magento/framework/View/Layout.php(555): Magento\Framework\View\Layout->_renderBlock('category.produc...') #47 /var/www/php/folder/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Framework\View\Layout->renderNonCachedElement('category.produc...') #48 /var/www/php/folder/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\View\Layout\Interceptor->___callParent('renderNonCached...', Array) #49 /var/www/php/folder/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Framework\View\Layout\Interceptor->Magento\Framework\Interception\{closure}('category.produc...') #50 /var/www/php/folder/generated/code/Magento/Framework/View/Layout/Interceptor.php(41): Magento\Framework\View\Layout\Interceptor->___callPlugins('renderNonCached...', Array, Array) #51 /var/www/php/folder/vendor/magento/framework/View/Layout.php(510): Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('category.produc...') #52 /var/www/php/folder/vendor/magento/framework/View/Layout.php(606): Magento\Framework\View\Layout->renderElement('category.produc...', false) #53 /var/www/php/folder/vendor/magento/framework/View/Layout.php(557): Magento\Framework\View\Layout->_renderContainer('content', false) #54 /var/www/php/folder/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Framework\View\Layout->renderNonCachedElement('content') #55 /var/www/php/folder/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\View\Layout\Interceptor->___callParent('renderNonCached...', Array) #56 /var/www/php/folder/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Framework\View\Layout\Interceptor->Magento\Framework\Interception\{closure}('content') #57 /var/www/php/folder/generated/code/Magento/Framework/View/Layout/Interceptor.php(41): Magento\Framework\View\Layout\Interceptor->___callPlugins('renderNonCached...', Array, Array) #58 /var/www/php/folder/vendor/magento/framework/View/Layout.php(510): Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('content') #59 /var/www/php/folder/vendor/magento/framework/View/Layout.php(606): Magento\Framework\View\Layout->renderElement('content', false) #60 /var/www/php/folder/vendor/magento/framework/View/Layout.php(557): Magento\Framework\View\Layout->_renderContainer('main', false) #61 /var/www/php/folder/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Framework\View\Layout->renderNonCachedElement('main') #62 /var/www/php/folder/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\View\Layout\Interceptor->___callParent('renderNonCached...', Array) #63 /var/www/php/folder/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Framework\View\Layout\Interceptor->Magento\Framework\Interception\{closure}('main') #64 /var/www/php/folder/generated/code/Magento/Framework/View/Layout/Interceptor.php(41): Magento\Framework\View\Layout\Interceptor->___callPlugins('renderNonCached...', Array, Array) #65 /var/www/php/folder/vendor/magento/framework/View/Layout.php(510): Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('main') #66 /var/www/php/folder/vendor/magento/framework/View/Layout.php(606): Magento\Framework\View\Layout->renderElement('main', false) #67 /var/www/php/folder/vendor/magento/framework/View/Layout.php(557): Magento\Framework\View\Layout->_renderContainer('columns', false) #68 /var/www/php/folder/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Framework\View\Layout->renderNonCachedElement('columns') #69 /var/www/php/folder/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\View\Layout\Interceptor->___callParent('renderNonCached...', Array) #70 /var/www/php/folder/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Framework\View\Layout\Interceptor->Magento\Framework\Interception\{closure}('columns') #71 /var/www/php/folder/generated/code/Magento/Framework/View/Layout/Interceptor.php(41): Magento\Framework\View\Layout\Interceptor->___callPlugins('renderNonCached...', Array, Array) #72 /var/www/php/folder/vendor/magento/framework/View/Layout.php(510): Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('columns') #73 /var/www/php/folder/vendor/magento/framework/View/Layout.php(606): Magento\Framework\View\Layout->renderElement('columns', false) #74 /var/www/php/folder/vendor/magento/framework/View/Layout.php(557): Magento\Framework\View\Layout->_renderContainer('main.content', false) #75 /var/www/php/folder/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Framework\View\Layout->renderNonCachedElement('main.content') #76 /var/www/php/folder/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\View\Layout\Interceptor->___callParent('renderNonCached...', Array) #77 /var/www/php/folder/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Framework\View\Layout\Interceptor->Magento\Framework\Interception\{closure}('main.content') #78 /var/www/php/folder/generated/code/Magento/Framework/View/Layout/Interceptor.php(41): Magento\Framework\View\Layout\Interceptor->___callPlugins('renderNonCached...', Array, Array) #79 /var/www/php/folder/vendor/magento/framework/View/Layout.php(510): Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('main.content') #80 /var/www/php/folder/vendor/magento/framework/View/Layout.php(606): Magento\Framework\View\Layout->renderElement('main.content', false) #81 /var/www/php/folder/vendor/magento/framework/View/Layout.php(557): Magento\Framework\View\Layout->_renderContainer('page.wrapper', false) #82 /var/www/php/folder/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Framework\View\Layout->renderNonCachedElement('page.wrapper') #83 /var/www/php/folder/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\View\Layout\Interceptor->___callParent('renderNonCached...', Array) #84 /var/www/php/folder/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Framework\View\Layout\Interceptor->Magento\Framework\Interception\{closure}('page.wrapper') #85 /var/www/php/folder/generated/code/Magento/Framework/View/Layout/Interceptor.php(41): Magento\Framework\View\Layout\Interceptor->___callPlugins('renderNonCached...', Array, Array) #86 /var/www/php/folder/vendor/magento/framework/View/Layout.php(510): Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('page.wrapper') #87 /var/www/php/folder/vendor/magento/framework/View/Layout.php(606): Magento\Framework\View\Layout->renderElement('page.wrapper', false) #88 /var/www/php/folder/vendor/magento/framework/View/Layout.php(557): Magento\Framework\View\Layout->_renderContainer('root', false) #89 /var/www/php/folder/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Framework\View\Layout->renderNonCachedElement('root') #90 /var/www/php/folder/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\View\Layout\Interceptor->___callParent('renderNonCached...', Array) #91 /var/www/php/folder/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Framework\View\Layout\Interceptor->Magento\Framework\Interception\{closure}('root') #92 /var/www/php/folder/generated/code/Magento/Framework/View/Layout/Interceptor.php(41): Magento\Framework\View\Layout\Interceptor->___callPlugins('renderNonCached...', Array, Array) #93 /var/www/php/folder/vendor/magento/framework/View/Layout.php(510): Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('root') #94 /var/www/php/folder/vendor/magento/framework/View/Layout.php(975): Magento\Framework\View\Layout->renderElement('root') #95 /var/www/php/folder/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Framework\View\Layout->getOutput() #96 /var/www/php/folder/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\View\Layout\Interceptor->___callParent('getOutput', Array) #97 /var/www/php/folder/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Framework\View\Layout\Interceptor->Magento\Framework\Interception\{closure}() #98 /var/www/php/folder/generated/code/Magento/Framework/View/Layout/Interceptor.php(50): Magento\Framework\View\Layout\Interceptor->___callPlugins('getOutput', Array, Array) #99 /var/www/php/folder/vendor/magento/framework/View/Result/Page.php(260): Magento\Framework\View\Layout\Interceptor->getOutput() #100 /var/www/php/folder/vendor/magento/framework/View/Result/Layout.php(171): Magento\Framework\View\Result\Page->render(Object(Magento\Framework\App\Response\Http\Interceptor)) #101 /var/www/php/folder/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Framework\View\Result\Layout->renderResult(Object(Magento\Framework\App\Response\Http\Interceptor)) #102 /var/www/php/folder/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\View\Result\Page\Interceptor->___callParent('renderResult', Array) #103 /var/www/php/folder/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Framework\View\Result\Page\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Response\Http\Interceptor)) #104 /var/www/php/folder/generated/code/Magento/Framework/View/Result/Page/Interceptor.php(32): Magento\Framework\View\Result\Page\Interceptor->___callPlugins('renderResult', Array, Array) #105 /var/www/php/folder/vendor/magento/framework/App/Http.php(120): Magento\Framework\View\Result\Page\Interceptor->renderResult(Object(Magento\Framework\App\Response\Http\Interceptor)) #106 /var/www/php/folder/vendor/magento/framework/App/Bootstrap.php(264): Magento\Framework\App\Http->launch() #107 /var/www/php/folder/pub/index.php(30): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http\Interceptor)) #108 {main}

Additional information

It looks like the file: src\folder\vendor\magento\module-elasticsearch\Model\ResourceModel\Fulltext\Collection\SearchResultApplier.php

Was rewritten massively in February 22, 2022: https://github.com/magento/magento2/blob/2.4-develop/app/code/Magento/Elasticsearch/Model/ResourceModel/Fulltext/Collection/SearchResultApplier.php

Compared to 2.4.4: https://github.com/magento/magento2/blob/2.4.4/app/code/Magento/Elasticsearch/Model/ResourceModel/Fulltext/Collection/SearchResultApplier.php

^^ this version works.

The change now pulls the categoryId with: $categoryId = $filter->getValue();

This returns an Array object with value of the CategoryId (a correct value = [“1234”]).

But the function: private function categoryProductByCustomSortOrder(int $categoryId): array

Expects an int.

I’m not sure yet if one of the custom plugins is responsible for this issue. Can anyone confirm that $categoryId = $filter->getValue(); pulls an INT and not ARRAY?

Release note

No response

Triage and priority

  • Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 51 (4 by maintainers)

Most upvoted comments

I also had this today, but I think it’s more related to Amasty. Anyway I created a quick fix that might help you too. patches/elasticsearch-fix.patch

--- /dev/null
+++ ../Model/ResourceModel/Fulltext/Collection/SearchResultApplier.php
@@ -187,6 +187,9 @@
             }
 
             if ($categoryId) {
+                if (is_array($categoryId)) {
+                    $categoryId = $categoryId[0];
+                }
                 $resultSet = $this->categoryProductByCustomSortOrder($categoryId);
                 foreach ($resultSet as $item) {
                     $ids[] = (int)$item['entity_id'];

Add below to your composer patches

            "magento/module-elasticsearch": {
                "Fix amasty elastic": "patches/elasticsearch-fix.patch"
            }

@Hanhan1989 @pmonosolo hello Guys, Please install amasty extension composer require amasty/module-mage-2.4.5-fix or as package from the support team - it will solve the issue Also we discussed this bug with Magento Team - they will revert changes from 2.4.5 version because they caused a lot of bugs and issues

Fix for SearchResultApplier sometimes does not fix the problem with the toolbar, we developed this small extension for our clients https://github.com/plumrocket/module-layered-navigation-fix-magento-2.4.5

Amasty said they have a package for this: composer require amasty/module-mage-2.4.5-fix

I have not tested it yet. Having issues today downloading packages for some reason - the processes stop midstream.

UPDATE: Looks like Amasty composer repo is throwing 403 for that package. Please reach out to their team to get direct zip file.

Recently upgraded to 2.4.5 and I have a similar error using Extra Sorting Options by RedChamps. When I set Display Out of Stock Products to False I also find the issue doesn’t occur. Yes, strict typization breaks different custom extensions( extensions who changes the category_ids params).

Alexey:

Did you add it only in your site. I know that CMS accepts everything. Same does not happen in infrastructure. So I asked to our backend to try again and here is our composer.json image

As you can see we tried with the version you are mentioning, but for some reason, it does not work on Magento Cloud, which makes me believe that your support team copy and paste answer is true and that for business reasons they don’t want to say to us to use it in Magento Cloud. So I will end up our conversation here.

We were able to circumvent the amasty layered nav vs magento 2.4.5 compatibility issues by applying ACP2E-748: Layered navigation filters don’t work when show out of stock is enabled as a composer patch. We’ve not resorted to the amasty/module-mage-2.4.5-fix package fix, it wasn’t needed with this patch.

Just FYI in case it helps.

For amasty users getting this error see the suggest in the composer.json “suggest”: { “amasty/shopby-graphql”: “Install shopby-graph-ql module to activate GraphQl and Shopby integration.”, “amasty/module-grouped-options”: “Install module-grouped-options module to activate Grouped Options integration.”, “amasty/module-shopby-livesearch-root-category”: “Install ShopbyLivesearchRootCategory module to activate LiveSearch for all Products Page and Shop By Brand integration.”, “amasty/module-shop-by-live-search”: “Install ShopByLiveSearch module to activate LiveSearch and Shop By Brand integration.”, “amasty/module-shopby-mftf-2”: “Install module-shopby-mftf-2 module to implement mftf-tests for Magento 2.3.6+ versions.”, “amasty/module-shopby-mftf-3”: “Install module-shopby-mftf-3 module to implement mftf-tests for Magento 2.4.1+ versions.”, “amasty/module-mage-2.4.5-fix”: “Install module-mage-2.4.5-fix to fix bugs with Product Collection Changes that were added in 2.4.5 version.” },

Hello @pmonosolo,

We have tried to reproduce the issue in the freshly installed Magento 2.4.5 and 2.4-develop branches. But for us, the issue was not reproducible. We have followed the below steps:

  1. Install Magento 2.4.5 & 2.4-develop.
  2. Install Sample data in both instances.
  3. Try to access the category page via the frontend. for e.g. Home > Men > Tops > Jackets
  4. Run the reindex command
  5. Check again the category page.

The page is working fine for us. Let us know in case we have missed anything.

Thanks

Could you please check the code? You set strict type INT for variable that called “categoryIds”. It should be plural

@Hanhan1989 @pmonosolo hello Guys, Please install amasty extension composer require amasty/module-mage-2.4.5-fix or as package from the support team - it will solve the issue Also we discussed this bug with Magento Team - they will revert changes from 2.4.5 version because they caused a lot of bugs and issues

I’m just wondering how they are going to roll back changes for released product 😃

Or is this for -p1 release? 😃

They told me only about development branch.

The issue seems to be solved when “Display Out of Stock Products” is false. (was true before). @harshj-magneto @pmonosolo , Could you verify this?

Setting is in the backend, Catalog > Inventory > Stock Options

Hello @pmonosolo,

We have tried to reproduce the issue in the freshly installed Magento 2.4.5 and 2.4-develop branches. But for us, the issue was not reproducible. We have followed the below steps:

  1. Install Magento 2.4.5 & 2.4-develop.
  2. Install Sample data in both instances.
  3. Try to access the category page via the frontend. for e.g. Home > Men > Tops > Jackets
  4. Run the reindex command
  5. Check again the category page.

The page is working fine for us. Let us know in case we have missed anything.

Thanks