Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
gaiterjones opened this issue Oct 11, 2024 · 12 comments
Assignees
Labels

Comments

@gaiterjones
Copy link

gaiterjones commented Oct 11, 2024

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
Copy link
Author

gaiterjones commented Oct 12, 2024

Update - downgrade issue was resolved by #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;
}

@gaiterjones gaiterjones changed the title Categories not loading after upgrade to 2.11.9 Virtual Categories not loading after upgrade to 2.11.9 Oct 13, 2024
@romainruaud
Copy link
Collaborator

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

Regards

@gaiterjones gaiterjones changed the title Virtual Categories not loading after upgrade to 2.11.9 Manually Sorted Categories not loading after upgrade to 2.11.9 Oct 17, 2024
@gaiterjones
Copy link
Author

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

@gaiterjones gaiterjones changed the title Manually Sorted Categories not loading after upgrade to 2.11.9 Categories with Manually Sorted Products not loading after upgrade to 2.11.9 Oct 17, 2024
@gaiterjones
Copy link
Author

Update

I have tested all releases from 2.11.5 to 2.11.9 and they all display the same error where I cannot load any categories with manually sorted products. Also the version that does work 2.11.4 will not compile in Magento 2.4.7-p3

Compilation was started.
Repositories code generation... 1/9 [===>------------------------]  11% 1 sec 96.0 MiBPHP Fatal error:  Declaration of Smile\ElasticsuiteCore\Model\ResourceModel\Search\Request\RelevanceConfig::_construct() must be compatible with Magento\Config\Model\ResourceModel\Config::_construct(?Magento\Framework\MessageQueue\PoisonPill\PoisonPillPutInterface $pillPut = null) in /var/www/dev/magento2/vendor/smile/elasticsuite/src/module-elasticsuite-core/Model/ResourceModel/Search/Request/RelevanceConfig.php on line 98

Fatal error: Declaration of Smile\ElasticsuiteCore\Model\ResourceModel\Search\Request\RelevanceConfig::_construct() must be compatible with Magento\Config\Model\ResourceModel\Config::_construct(?Magento\Framework\MessageQueue\PoisonPill\PoisonPillPutInterface $pillPut = null) in /var/www/dev/magento2/vendor/smile/elasticsuite/src/module-elasticsuite-core/Model/ResourceModel/Search/Request/RelevanceConfig.php on line 98

@romainruaud
Copy link
Collaborator

@gaiterjones can you check if this PR fixes your issue ? #3419

By the way, how much products having a position are you having in this category ? I guess you're having a lot of them.

Regards

@gaiterjones
Copy link
Author

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

@romainruaud
Copy link
Collaborator

@gaiterjones the manual sort is only displayed when sorting by "Position" now. So most likely it's not shown because your current sort order is " ".

What do you have in the dropdown of the "Default Product Listing Sort By" ?

Regards

@gaiterjones
Copy link
Author

gaiterjones commented Oct 22, 2024

@romainruaud as I said both dropdowns Default Product Listing Sort By and Sort Direction are empty.

If I try to force position as the only available listing sortby I get the error "Default Product Listing Sort by does not exist in Available Product Listing Sort By".

es-sort-by

NOTE - in 2.11.4.2 the dropdown is populated:

es-sort-by2

@romainruaud
Copy link
Collaborator

Do you have any javascript error in the console ?

The dropdown for Sort Direction is a source model with just ASC and DESC, very surprising that this dropdown appears empty.

Regards

@gaiterjones
Copy link
Author

gaiterjones commented Oct 23, 2024

@romainruaud in 2.11.4.2 the dropdown is populated.

No JS errors seen in the console.

Default Product Listing Sort By and Sort Direction dropdown boxes are empty in ALL categories

@vahonc
Copy link
Collaborator

vahonc commented Oct 28, 2024

@gaiterjones, it looks like it's quite a specific issue because we can't reproduce it and figure out how Default Product Listing Sort By and Sort Direction dropdown boxes could be empty in ALL categories.

Most likely, the cause of your problem is somewhere in the database. I'm not sure if the problem is on the Elasticsuite side in this case, of course I could be wrong.

Could you try to test your issue on a fresh Magento with the latest version of the Elasticsuite to make sure that everything works as it should, and then try to import a database dump of your store to check if the problem is somewhere in the database.

BR,
Vadym

@gaiterjones
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants