elasticsuite: Manually Sorted Category Products not working after upgrade to 2.11.9

After upgrading from 2.11.4.2 to 2.11.9 all categories with manual sorting enabled will not load in backend see errors below.

If I try to downgrade to 2.11.4.2 I cannot open any categories due to an exception error

Magento Version : 2.4.6p3

ElasticSuite Version : 7.16.1

Environment : Production

Steps to reproduce

  1. upgrade from 2.11.4.2 to 2.11.9
  2. open any category in backend admin with manual sorting enabled

Expected result

  1. In backend admin clicking on a categories with manual sorted products should open without error

Actual result

Cannot open any category in backend admin with manually sorted products as shown in screenshot Weihnachtsmarkt and sub categories: es_Untitled-1

Logged error in 2.11.9 when clicking on category with manual sorted products in backend

[2024-10-11T13:35:39.710691+00:00] main.CRITICAL: TypeError: Smile\ElasticsuiteVirtualCategory\Model\Preview::getSortBy(): Return value must be of type string, null returned in /var/www/dev/magento2/vendor/smile/elasticsuite/src/module-elasticsuite-virtual-category/Model/Preview.php:224

Exception report when downgrading to 2.11.4.2 and clicking any category in backend

{"0":"Class \"Smile\\ElasticsuiteCatalog\\Model\\Category\\Attribute\\Source\\SortDirection\" does not exist","1":"#1 Magento\\Framework\\Code\\Reader\\ClassReader->getConstructor() called at [vendor\/magento\/framework\/ObjectManager\/Definition\/Runtime.php:54]\n#2 Magento\\Framework\\ObjectManager\\Definition\\Runtime->getParameters() called at [vendor\/magento\/framework\/ObjectManager\/Factory\/Compiled.php:100]\n#3 Magento\\Framework\\ObjectManager\\Factory\\Compiled->create() called at [vendor\/magento\/framework\/ObjectManager\/ObjectManager.php:56]\n#4 Magento\\Framework\\ObjectManager\\ObjectManager->create() called at [vendor\/magento\/framework\/Validator\/UniversalFactory.php:36]\n#5 Magento\\Framework\\Validator\\UniversalFactory->create() called at [vendor\/magento\/module-eav\/Model\/Entity\/Attribute\/AbstractAttribute.php:642]\n#6 Magento\\Eav\\Model\\Entity\\Attribute\\AbstractAttribute->getSource() called at [generated\/code\/Magento\/Catalog\/Model\/ResourceModel\/Eav\/Attribute\/Interceptor.php:824]\n#7 Magento\\Catalog\\Model\\ResourceModel\\Eav\\Attribute\\Interceptor->getSource() called at [vendor\/magento\/module-catalog\/Model\/Category\/DataProvider.php:427]\n#8 Magento\\Catalog\\Model\\Category\\DataProvider->getAttributesMeta() called at [vendor\/magento\/framework\/Interception\/Interceptor.php:58]\n#9 Smartwave\\Megamenu\\Model\\Category\\DataProvider\\Interceptor->___callParent() called at [vendor\/magento\/framework\/Interception\/Interceptor.php:138]\n#10 Smartwave\\Megamenu\\Model\\Category\\DataProvider\\Interceptor->Magento\\Framework\\Interception\\{closure}() called at [vendor\/magento\/framework\/Interception\/Interceptor.php:153]\n#11 Smartwave\\Megamenu\\Model\\Category\\DataProvider\\Interceptor->___callPlugins() called at [generated\/code\/Smartwave\/Megamenu\/Model\/Category\/DataProvider\/Interceptor.php:50]\n#12 Smartwave\\Megamenu\\Model\\Category\\DataProvider\\Interceptor->getAttributesMeta() called at [vendor\/magento\/module-catalog\/Model\/Category\/DataProvider.php:335]\n#13 Magento\\Catalog\\Model\\Category\\DataProvider->prepareMeta() called at [vendor\/magento\/framework\/Interception\/Interceptor.php:58]\n#14 Smartwave\\Megamenu\\Model\\Category\\DataProvider\\Interceptor->___callParent() called at [vendor\/magento\/framework\/Interception\/Interceptor.php:138]\n#15 Smartwave\\Megamenu\\Model\\Category\\DataProvider\\Interceptor->Magento\\Framework\\Interception\\{closure}() called at [vendor\/magento\/framework\/Interception\/Interceptor.php:153]\n#16 Smartwave\\Megamenu\\Model\\Category\\DataProvider\\Interceptor->___callPlugins() called at [generated\/code\/Smartwave\/Megamenu\/Model\/Category\/DataProvider\/Interceptor.php:32]\n#17 Smartwave\\Megamenu\\Model\\Category\\DataProvider\\Interceptor->prepareMeta() called at [vendor\/magento\/module-catalog\/Model\/Category\/DataProvider.php:267]\n#18 Magento\\Catalog\\Model\\Category\\DataProvider->getMeta() called at [vendor\/magento\/framework\/Interception\/Interceptor.php:58]\n#19 Smartwave\\Megamenu\\Model\\Category\\DataProvider\\Interceptor->___callParent() called at [vendor\/magento\/framework\/Interception\/Interceptor.php:138]\n#20 Smartwave\\Megamenu\\Model\\Category\\DataProvider\\Interceptor->Magento\\Framework\\Interception\\{closure}() called at [vendor\/smile\/elasticsuite\/src\/module-elasticsuite-catalog\/Plugin\/Ui\/Category\/Form\/DataProviderPlugin.php:95]\n#21 Smile\\ElasticsuiteCatalog\\Plugin\\Ui\\Category\\Form\\DataProviderPlugin->aroundGetMeta() called at [vendor\/magento\/framework\/Interception\/Interceptor.php:135]\n#22 Smartwave\\Megamenu\\Model\\Category\\DataProvider\\Interceptor->Magento\\Framework\\Interception\\{closure}() called at [vendor\/magento\/framework\/Interception\/Interceptor.php:153]\n#23 Smartwave\\Megamenu\\Model\\Category\\DataProvider\\Interceptor->___callPlugins() called at [generated\/code\/Smartwave\/Megamenu\/Model\/Category\/DataProvider\/Interceptor.php:23]\n#24 Smartwave\\Megamenu\\Model\\Category\\DataProvider\\Interceptor->getMeta() called at [vendor\/magento\/framework\/View\/Element\/UiComponentFactory.php:330]\n#25 Magento\\Framework\\View\\Element\\UiComponentFactory->mergeMetadata() called at [vendor\/magento\/framework\/View\/Element\/UiComponentFactory.php:231]\n#26 Magento\\Framework\\View\\Element\\UiComponentFactory->create() called at [vendor\/magento\/framework\/View\/Layout\/Generator\/UiComponent.php:140]\n#27 Magento\\Framework\\View\\Layout\\Generator\\UiComponent->generateComponent() called at [vendor\/magento\/framework\/View\/Layout\/Generator\/UiComponent.php:103]\n#28 Magento\\Framework\\View\\Layout\\Generator\\UiComponent->process() called at [vendor\/magento\/framework\/View\/Layout\/GeneratorPool.php:93]\n#29 Magento\\Framework\\View\\Layout\\GeneratorPool->process() called at [vendor\/magento\/framework\/View\/Layout.php:365]\n#30 Magento\\Framework\\View\\Layout->generateElements() called at [generated\/code\/Magento\/Framework\/View\/Layout\/Interceptor.php:32]\n#31 Magento\\Framework\\View\\Layout\\Interceptor->generateElements() called at [vendor\/magento\/framework\/View\/Layout\/Builder.php:129]\n#32 Magento\\Framework\\View\\Layout\\Builder->generateLayoutBlocks() called at [vendor\/magento\/framework\/View\/Page\/Builder.php:65]\n#33 Magento\\Framework\\View\\Page\\Builder->generateLayoutBlocks() called at [vendor\/magento\/framework\/View\/Layout\/Builder.php:65]\n#34 Magento\\Framework\\View\\Layout\\Builder->build() called at [vendor\/magento\/framework\/View\/Layout.php:271]\n#35 Magento\\Framework\\View\\Layout->build() called at [vendor\/magento\/framework\/View\/Layout.php:896]\n#36 Magento\\Framework\\View\\Layout->getBlock() called at [vendor\/magento\/module-backend\/Model\/View\/Result\/Page.php:26]\n#37 Magento\\Backend\\Model\\View\\Result\\Page->setActiveMenu() called at [vendor\/magento\/module-catalog\/Controller\/Adminhtml\/Category\/Edit.php:113]\n#38 Magento\\Catalog\\Controller\\Adminhtml\\Category\\Edit->execute() called at [vendor\/magento\/framework\/Interception\/Interceptor.php:58]\n#39 Magento\\Catalog\\Controller\\Adminhtml\\Category\\Edit\\Interceptor->___callParent() called at [vendor\/magento\/framework\/Interception\/Interceptor.php:138]\n#40 Magento\\Catalog\\Controller\\Adminhtml\\Category\\Edit\\Interceptor->Magento\\Framework\\Interception\\{closure}() called at [vendor\/magento\/framework\/Interception\/Interceptor.php:153]\n#41 Magento\\Catalog\\Controller\\Adminhtml\\Category\\Edit\\Interceptor->___callPlugins() called at [generated\/code\/Magento\/Catalog\/Controller\/Adminhtml\/Category\/Edit\/Interceptor.php:23]\n#42 Magento\\Catalog\\Controller\\Adminhtml\\Category\\Edit\\Interceptor->execute() called at [vendor\/magento\/framework\/App\/Action\/Action.php:111]\n#43 Magento\\Framework\\App\\Action\\Action->dispatch() called at [vendor\/magento\/module-backend\/App\/AbstractAction.php:151]\n#44 Magento\\Backend\\App\\AbstractAction->dispatch() called at [vendor\/magento\/framework\/Interception\/Interceptor.php:58]\n#45 Magento\\Catalog\\Controller\\Adminhtml\\Category\\Edit\\Interceptor->___callParent() called at [vendor\/magento\/framework\/Interception\/Interceptor.php:138]\n#46 Magento\\Catalog\\Controller\\Adminhtml\\Category\\Edit\\Interceptor->Magento\\Framework\\Interception\\{closure}() called at [vendor\/magento\/module-backend\/App\/Action\/Plugin\/Authentication.php:145]\n#47 Magento\\Backend\\App\\Action\\Plugin\\Authentication->aroundDispatch() called at [vendor\/magento\/framework\/Interception\/Interceptor.php:135]\n#48 Magento\\Catalog\\Controller\\Adminhtml\\Category\\Edit\\Interceptor->Magento\\Framework\\Interception\\{closure}() called at [vendor\/magento\/framework\/Interception\/Interceptor.php:153]\n#49 Magento\\Catalog\\Controller\\Adminhtml\\Category\\Edit\\Interceptor->___callPlugins() called at [generated\/code\/Magento\/Catalog\/Controller\/Adminhtml\/Category\/Edit\/Interceptor.php:32]\n#50 Magento\\Catalog\\Controller\\Adminhtml\\Category\\Edit\\Interceptor->dispatch() called at [vendor\/magento\/framework\/App\/FrontController.php:245]\n#51 Magento\\Framework\\App\\FrontController->getActionResponse() called at [vendor\/magento\/framework\/App\/FrontController.php:212]\n#52 Magento\\Framework\\App\\FrontController->processRequest() called at [vendor\/magento\/framework\/App\/FrontController.php:147]\n#53 Magento\\Framework\\App\\FrontController->dispatch() called at [vendor\/magento\/framework\/Interception\/Interceptor.php:58]\n#54 Magento\\Framework\\App\\FrontController\\Interceptor->___callParent() called at [vendor\/magento\/framework\/Interception\/Interceptor.php:138]\n#55 Magento\\Framework\\App\\FrontController\\Interceptor->Magento\\Framework\\Interception\\{closure}() called at [vendor\/magento\/framework\/Interception\/Interceptor.php:153]\n#56 Magento\\Framework\\App\\FrontController\\Interceptor->___callPlugins() called at [generated\/code\/Magento\/Framework\/App\/FrontController\/Interceptor.php:23]\n#57 Magento\\Framework\\App\\FrontController\\Interceptor->dispatch() called at [vendor\/magento\/framework\/App\/Http.php:116]\n#58 Magento\\Framework\\App\\Http->launch() called at [vendor\/magento\/framework\/App\/Bootstrap.php:264]\n#59 Magento\\Framework\\App\\Bootstrap->run() called at [pub\/index.php:30]\n","url":"\/vwe_dev_2k20_1\/catalog\/category\/index\/key\/cc7e48329d142bdd5f44d8268caa2351653e774378b599bae3a612e4ccf2576f\/","script_name":"\/index.php","report_id":"5e332749c9480e797b3aa3efcd3eb81aa344a021107274735874fbe8e6957179"}

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 22

Most upvoted comments

I think the best option is to comment out the di preference

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <!--<preference for="Magento\Catalog\Model\Category\DataProvider" type="Smartwave\Megamenu\Model\Category\DataProvider" />-->
</config>

Thanks again for all assistance given, I would never have thought a frontend menu module would be the cause of a backend admin problem - I guess eventually I might have found it but It would have taken me a long time!

@vahonc all I can say is that I have been using elasticsuite in production for five years without any issues and the update since 2.11.5 has now broken some functionality. I will do some more testing as you have suggested.

Related: https://github.com/magento/magento2/issues/30586 Seems it was an issue to add fields to the category form in older versions of Magento, and devs did just overwrite that function without caring about other modules. Indeed very crappy, but I guess it was needed.

Another thread here: https://github.com/Smile-SA/elasticsuite/issues/3309 The last comments made me dive into the Megamenu module, would be nice if we can put this post also on that thread.

@gaiterjones In my project I only use the frontend part of the module, it only shows a couple of static blocks with content. But I can still update and change the category fields in the backend, just don’t know if it changes anything. Just give it a try.

very interesting !

but it also looks like a crappy implementation on the Porto side, no ?

I mean, they could inherit the existing values at some point, or just add what they need with a plugin, instead of overwriting stuff …

@romainruaud after upgrading to 2.11.9.1 the categories load now but the manual sort option is not available see images below:

2.11.9.1 es-new-version

2.11.4.2 es-old-version

Notice in 2,11,9,1 the listing sort by and sort direction drop downs are not populated.

There are not more than 20 or 30 products in the manually sorted category.

I had the same “Not populated fields” error, found out it was related to the Megamenu of my theme (Porto). Check if any of your modules is overwriting the DataProvider protected function getFieldsMap(). Mine was returning an array missing the fields from Elastic Suite. I just commented the whole function, now it works.