Smile-SA / elasticsuite

Smile ElasticSuite - Magento 2 merchandising and search engine built on ElasticSearch
https://elasticsuite.io
Open Software License 3.0
761 stars 340 forks source link

Categories with Manually Sorted Products not loading after upgrade to 2.11.9 #3409

Open gaiterjones opened 1 week ago

gaiterjones commented 1 week ago

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

gaiterjones commented 1 week ago

Update - downgrade issue was resolved by https://github.com/Smile-SA/elasticsuite/issues/3390 backend categories are working again. Downgraded the module and will wait for further updates before using the new version.

This problem with latest version still exists:

Logged error in 2.11.9 when clicking on category with manual (virtual category?) 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

/**
 * Get sort by attribute.
 *
 * @return string
 */
private function getSortBy() : string
{
    if (!$this->sortBy) {
        $useConfig = $this->request->getParam('use_config', []);
        $useConfig = array_key_exists('default_sort_by', $useConfig) && $useConfig['default_sort_by'] == 'true';
        $defaultSortBy = $this->categoryConfig->getProductListDefaultSortBy();
        $this->sortBy = $useConfig ? $defaultSortBy : $this->request->getParam('default_sort_by');
    }

    return $this->sortBy;
}
romainruaud commented 4 days ago

@gaiterjones can you add more details especially about PHP version and Magento deploy mode ? (I guess it's production).

Regards

gaiterjones commented 3 days ago

@romainruaud tested with PHP8.1, PHP8.3 and Magento 2.4.6, 2.4.7 in developer and production modes.