magento2 icon indicating copy to clipboard operation
magento2 copied to clipboard

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

Open pmonosolo opened this issue 3 years ago • 13 comments

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

  • [X] 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”.

pmonosolo avatar Aug 11 '22 22:08 pmonosolo

Hi @pmonosolo. Thank you for your report. To speed up processing of this issue, make sure that you provided the following information:

  • Summary of the issue
  • Information on your environment
  • Steps to reproduce
  • Expected and actual results

Make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, Add a comment to the issue:

@magento give me 2.4-develop instance - upcoming 2.4.x release

For more details, review the Magento Contributor Assistant documentation.

Add a comment to assign the issue: @magento I am working on this

To learn more about issue processing workflow, refer to the Code Contributions.


:warning: According to the Magento Contribution requirements, all issues must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting.

:clock10: You can find the schedule on the Magento Community Calendar page.

:telephone_receiver: The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, join the Community Contributions Triage session to discuss the appropriate ticket.

:pencil2: Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel

m2-assistant[bot] avatar Aug 11 '22 22:08 m2-assistant[bot]

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"
            }

anvanza avatar Aug 12 '22 06:08 anvanza

Hi @engcom-Hotel. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

  • [ ] 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).

    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.

  • [ ] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • [ ] 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • [ ] 4. Verify that the issue is reproducible on 2.4-develop branch

    Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

  • [ ] 5. Add label Issue: Confirmed once verification is complete.

  • [ ] 6. Make sure that automatic system confirms that report has been added to the backlog.

m2-assistant[bot] avatar Aug 12 '22 06:08 m2-assistant[bot]

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

engcom-Hotel avatar Aug 12 '22 07:08 engcom-Hotel

Is there any solution to on this I am also facing the same problem after upgrading the Magento version from 2.4.4 to 2.4.5.

harshj-magneto avatar Aug 12 '22 11:08 harshj-magneto

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

anvanza avatar Aug 12 '22 13:08 anvanza

@magento give me 2.4.5 instance

anvanza avatar Aug 12 '22 13:08 anvanza

Hi @anvanza. Thank you for your request. I'm working on Magento instance for you.

Hi @anvanza, here is your Magento Instance: https://bb428a31a1404362b81426b01f4a324c.instances.magento-community.engineering Admin access: https://bb428a31a1404362b81426b01f4a324c.instances.magento-community.engineering/admin_0cc8 Login: b80cfe90 Password: 593e0dc6dfc1

.

@anvanza this is working after "Display Out of Stock Products" to false but i need to display outofstock product is there any solution to this.

harshj-magneto avatar Aug 12 '22 13:08 harshj-magneto

No, I don't have a solution. Feel free to share your own findings here.. Are you using an Amasty module?

anvanza avatar Aug 12 '22 13:08 anvanza

@anvanza yep i am using amasty layered navigation and welt pixel theme

harshj-magneto avatar Aug 12 '22 13:08 harshj-magneto

I think it's best to open a ticket with Amasty as it seems their module is not working as it should.

anvanza avatar Aug 12 '22 13:08 anvanza

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.

pmonosolo avatar Aug 12 '22 16:08 pmonosolo

I couldn't reproduce the problem either. I think this problem can be caused by third party modules.

Hanhan1989 avatar Aug 14 '22 20:08 Hanhan1989

@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

alexey-motorny-amasty avatar Aug 15 '22 08:08 alexey-motorny-amasty

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.

drinkingsouls avatar Aug 15 '22 12:08 drinkingsouls

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-motorny-amasty avatar Aug 15 '22 12:08 alexey-motorny-amasty

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

Sorry it looks like it's related to Amasty Layered Navigation module.

Please keep this topic open because it seems like there are a lot of users having the same issue.

pmonosolo avatar Aug 15 '22 16:08 pmonosolo

@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? :)

pmonosolo avatar Aug 15 '22 18:08 pmonosolo

@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.

alexey-motorny-amasty avatar Aug 16 '22 06:08 alexey-motorny-amasty

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

alexey-motorny-amasty avatar Aug 16 '22 06:08 alexey-motorny-amasty

Hello @pmonosolo,

As the issue is related to Third-party i.e. Amasty and not from Magento's core module, hence we are closing this issue.

Thanks for reporting this issue.

Thanks

engcom-Hotel avatar Aug 22 '22 07:08 engcom-Hotel

@magento give me 2.4-develop instance

Olha27691 avatar Aug 23 '22 17:08 Olha27691

Hi @Olha27691. Thank you for your request. I'm working on Magento instance for you.

Hi @Olha27691, here is your Magento Instance: https://cfbce8f723b35679a04fdbf24dbd5a12.instances.magento-community.engineering Admin access: https://cfbce8f723b35679a04fdbf24dbd5a12.instances.magento-community.engineering/admin_8fd1 Login: 78f3aece Password: a8be8a71c851

@anvanza @engcom-Hotel

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

It looks like there is a separate issue with Display Out of Stock Products.

Search for "ryker" on vanilla Magento 2.4.5, Diplay Out of Stock = "NO":

image

We change Diplay Out of Stock = "YES" + refresh cache + reindex

image

I'll submit this as a separate bug.

Here it is: https://github.com/magento/magento2/issues/36055

pmonosolo avatar Aug 30 '22 19:08 pmonosolo

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." },

sdouma avatar Sep 20 '22 17:09 sdouma

Changing the public function apply code on line 101 in SearchResultApplier.php to this also fixes it:

    public function apply()
    {
        if (empty($this->searchResult->getItems())) {
            $this->collection->getSelect()->where('NULL');
            return;
        }

        $ids = [];
        $orderIds = $this->getProductIdsBySaleability();

        $items = $this->sliceItems($this->searchResult->getItems(), $this->size, $this->currentPage);
        foreach ($items as $item) {
            $ids[] = (int)$item->getId();
        }

        $orderList = count($orderIds) ? implode(',', $orderIds) : implode(',', $ids);
        $this->collection->getSelect()
            ->where('e.entity_id IN (?)', $ids)
            ->reset(\Magento\Framework\DB\Select::ORDER)
            ->order(new \Zend_Db_Expr("FIELD(e.entity_id,$orderList)"));
    }

Fix provided by Mirasvit

git-seb avatar Sep 21 '22 13:09 git-seb

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

06romix avatar Oct 06 '22 14:10 06romix