2

Since i updated my instance from 2.3 to 2.4.5-p1 somehow my shop is not filtering products anymore in the category list pages. I tried to debug it and these steps are already taken:

  • Flushed cache (ofcourse 23523523 times)
  • Upgraded Elastic to 7.17.6 and rebuild full index
  • Fallback to native magento blank theme (still not filtering)

When i review what the site is doing it creates an url like this: https://domain.tld/exams.html?location_city=1800

The page itself shows me a paginator with 2 pages where there should be 14 products as also indicated by the filter on the sidebar. However on the top it still keeps showing "205 Items" and all the items are actually shown (limited by what the paginator does).

I started digging further inside the code and found that Elasticsearch is returning the right values for a query:

^ Magento\Framework\Search\Response\QueryResponse {#2321 ▼
  #documents: array:6 [▼
    0 => Magento\Framework\Api\Search\Document {#2229 ▶}
    1 => Magento\Framework\Api\Search\Document {#2282 ▶}
    2 => Magento\Framework\Api\Search\Document {#2288 ▶}
    3 => Magento\Framework\Api\Search\Document {#2286 ▶}
    4 => Magento\Framework\Api\Search\Document {#2227 ▶}
    5 => Magento\Framework\Api\Search\Document {#2290 ▶}
  ]
  #aggregations: Magento\Framework\Search\Response\Aggregation {#2318 ▶}
  -total: 6
}

As expected in these case since the filter hold 6 results.

Hope that someone has an idea

Thanks!

1
  • We just faced this issue after upgrading from 2.3 to 2.4.5-p1 and we applied the fix hereabove. However, is it possible that it causes an important negativ impact on loading time on our categories pages ? And indeed, the number of total items is wrong... Thank you for your work Feb 9, 2023 at 9:23

4 Answers 4

2

This issue has already been resolved in Magento 2.4-develop branch. To apply the fix, apply this patch: https://github.com/magento/magento2/commit/a9170022cce29993e586ffaa6f4c1cc357ee3b11.diff

Related commit: https://github.com/magento/magento2/commit/a9170022cce29993e586ffaa6f4c1cc357ee3b11

Related pull request: https://github.com/magento/magento2/pull/35986/

2
  • This commit does not solve the problem. Filter then works partially so its not a solution at all. Also the top nav still says 200+ products instead of the ones that are there
    – Dirkos
    Oct 19, 2022 at 13:44
  • If you applied this patch, it will resolve the issue: "show all products (205 items in your case) of the category instead of the filtered products (6 items in your case) after applying the filter". There is another issue: the number of total items is wrong, and that issue is not fixed at the moment. I'll try to fix it in the next queue then update the solution here.
    – Tu Van
    Oct 20, 2022 at 5:19
2

Try this solution https://github.com/plumrocket/module-layered-navigation-fix-magento-2.4.5

This will fix the concern and give your website smooth loading.

1

Create a new module and add this code in di.xml of your new module.

<!-- Disable erratic plugin on toolbar.
This plugin is not needed because Elasticsuite already filters properly the products.
So we have accurate product count in the toolbar from the ES response. -->
<type name="\Magento\Catalog\Block\Product\ProductList\Toolbar">
    <!-- This plugin is defined in magento/module-inventory-catalog -->
    <plugin name="update_toolbar_count" disabled="true"/>
</type>

Reference: https://github.com/Smile-SA/elasticsuite/pull/2774/files

Or, you can create a patch to disable the update_toolbar_count plugin. The code is present at the bottom of the file: vendor/magento/module-inventory-catalog/etc/di.xml

<type name="Magento\Catalog\Block\Product\ProductList\Toolbar">
    <plugin 
        name="update_toolbar_count" 
        type="Magento\InventoryCatalog\Plugin\Catalog\Block\ProductList\UpdateToolbarCount" 
        disabled="true" />
</type>
1
  • Is there a patch for this issue since this appears to be a known issue with 2.4.5.x versions without making changes to the out of the box code?
    – cnu
    Jul 3, 2023 at 16:23
1

This issue has already been resolved in Magento 2.4-develop branch. To apply the fix, apply this patch:

https://github.com/magento/magento2/commit/a9170022cce29993e586ffaa6f4c1cc357ee3b11.diff

Related commit: https://github.com/magento/magento2/commit/a9170022cce29993e586ffaa6f4c1cc357ee3b11

Related pull request: https://github.com/magento/magento2/pull/35986/

1
  • Is this fix ported to 2.4.5 version as we're seeing Reference to undeclared plugin with name 'update_toolbar_count' error with that version or that's something else?
    – cnu
    Jul 10, 2023 at 18:19

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.