Smile-SA / elasticsuite

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

Schedules Updates not working on Category #2145

Closed bretin closed 3 years ago

bretin commented 3 years ago

An error happens when trying to do a Schedule update on a category

Preconditions

Magento Version : 2.4.2-p1 EE

ElasticSuite Version : 2.10.3 and 2.10.4

Environment : Dev

Third party modules : N/A

Steps to reproduce

  1. Login into the Backend
  2. Navigate to Catalog -> Categories. Be sure, you activated the Default Category
  3. Click on the Schedule New Update button.

Expected result

  1. Display the Schedule category update form

Actual result

  1. The error-message "Attention Something went wrong." appears.
  2. The Ajax call https://magento.txt/admin/mui/index/render_handle/handle/catalogstaging_category_update/buttons/1/key/abc/?namespace=catalogstaging_category_update_form&store=0&id=3&isAjax=true returns an error
    #1 Magento\Framework\View\Element\UiComponentFactory->mergeMetadataItem() called at [vendor/magento/framework/View/Element/UiComponentFactory.php:334]
    #2 Magento\Framework\View\Element\UiComponentFactory->mergeMetadata() called at [vendor/magento/framework/View/Element/UiComponentFactory.php:231]
    #3 Magento\Framework\View\Element\UiComponentFactory->create() called at [vendor/magento/framework/View/Layout/Generator/UiComponent.php:140]
    #4 Magento\Framework\View\Layout\Generator\UiComponent->generateComponent() called at [vendor/magento/framework/View/Layout/Generator/UiComponent.php:103]
    #5 Magento\Framework\View\Layout\Generator\UiComponent->process() called at [vendor/magento/framework/View/Layout/GeneratorPool.php:93]
    ...

This was working correctly in Magento 2.4.1. It looks like Magento tries to load the section assign_products in the schedule update form but it should not. Magento changed the method protected function getFieldsMap() in vendor/magento/module-catalog/Model/Category/DataProvider.php This might be the reason why we are having the error now.

Thanks in advance for the help!!

romainruaud commented 3 years ago

@vahonc can you try to reproduce this one ? If confirmed, we'll see how to handle it.

Thank you

vahonc commented 3 years ago

Hi to all,

I've investigated this issue on several test instances with Magento 2.4.x and ES 2.10.x. Indeed on the instance with Magento EE 2.4.2 this bug is reproducible, while on Magento EE 2.4.1 there are no errors, and looks like everything works. I also comparing protected function getFieldsMap() from vendor/magento/module-catalog/Model/Category/DataProvider.php in both versions of Magento and them different.

Finally, I've removed ES 2.10.x from my test instance with Magento EE 2.4.2 and check again this issue and they still occurred. Therefore I think this bug is not related to our module and @bretin you should report this bug on the Magento forum (Github bag tracker)

BR, Vadym

bretin commented 3 years ago

Hi @vahonc,

Thanks for your tests!

I re ran some tests on a Magento 2.4.2 p1 vanilla without any third party module and the schedule update works well. Could you please confirm me that you have a different result?

If I put back ES, the error comes back again.

Thanks again for your support

Nicolas

vahonc commented 3 years ago

Hi @bretin,

I can't test this bug on Magento 2.4.2-p1, but I re-installed my test environment with Magento EE 2.4.2 fresh vanilla without any third-party module and you're right, the schedule update works well. After that, I installed ES 2.10.4 and the error occurred.

I'll try to investigate this issue deeper.

BR, Vadym

adamj88 commented 3 years ago

We're also suffering with the same problem on 2.4.2-p1 (Commerce), just to provide some more information on the specific error logged:

In the system.log the below message is logged:

The "componentType" configuration parameter is required for the "assign_products" component

And the full trace:

Magento\Framework\Exception\LocalizedException: The "componentType" configuration parameter is required for the "assign_products" component.
#49 vendor/magento/framework/View/Element/UiComponentFactory.php(405): Magento\Framework\View\Element\UiComponentFactory::mergeMetadataItem
#48 vendor/magento/framework/View/Element/UiComponentFactory.php(425): Magento\Framework\View\Element\UiComponentFactory::mergeMetadataItem
#47 vendor/magento/framework/View/Element/UiComponentFactory.php(334): Magento\Framework\View\Element\UiComponentFactory::mergeMetadata
#46 vendor/magento/framework/View/Element/UiComponentFactory.php(231): Magento\Framework\View\Element\UiComponentFactory::create
#45 vendor/magento/framework/View/Layout/Generator/UiComponent.php(140): Magento\Framework\View\Layout\Generator\UiComponent::generateComponent
#44 vendor/magento/framework/View/Layout/Generator/UiComponent.php(103): Magento\Framework\View\Layout\Generator\UiComponent::process
#43 vendor/magento/framework/View/Layout/GeneratorPool.php(93): Magento\Framework\View\Layout\GeneratorPool::process
#42 vendor/magento/framework/View/Layout.php(365): Magento\Framework\View\Layout::generateElements
#41 /Magento/Framework/View/Layout/Interceptor.php(32): Magento\Framework\View\Layout\Interceptor::generateElements
#40 vendor/magento/framework/View/Layout/Builder.php(129): Magento\Framework\View\Layout\Builder::generateLayoutBlocks
#39 vendor/magento/framework/View/Page/Builder.php(65): Magento\Framework\View\Page\Builder::generateLayoutBlocks
#38 vendor/magento/framework/View/Layout/Builder.php(65): Magento\Framework\View\Layout\Builder::build
#37 vendor/magento/framework/View/Page/Config.php(224): Magento\Framework\View\Page\Config::build
#36 vendor/magento/framework/View/Page/Config.php(237): Magento\Framework\View\Page\Config::publicBuild
#35 vendor/magento/framework/App/View.php(170): Magento\Framework\App\View::loadLayoutUpdates
#34 vendor/magento/framework/App/View.php(114): Magento\Framework\App\View::loadLayout
#33 vendor/magento/module-ui/Controller/Adminhtml/Index/Render/Handle.php(55): Magento\Ui\Controller\Adminhtml\Index\Render\Handle::execute
#32 vendor/magento/framework/Interception/Interceptor.php(58): Magento\Ui\Controller\Adminhtml\Index\Render\Handle\Interceptor::___callParent
#31 vendor/magento/framework/Interception/Interceptor.php(138): Magento\Ui\Controller\Adminhtml\Index\Render\Handle\Interceptor::Magento\Framework\Interception\{closure}
#30 vendor/magento/framework/App/Action/Plugin/ActionFlagNoDispatchPlugin.php(51): Magento\Framework\App\Action\Plugin\ActionFlagNoDispatchPlugin::aroundExecute
#29 vendor/magento/framework/Interception/Interceptor.php(135): Magento\Ui\Controller\Adminhtml\Index\Render\Handle\Interceptor::Magento\Framework\Interception\{closure}
#28 vendor/magento/framework/Interception/Interceptor.php(153): Magento\Ui\Controller\Adminhtml\Index\Render\Handle\Interceptor::___callPlugins
#27 /Magento/Ui/Controller/Adminhtml/Index/Render/Handle/Interceptor.php(23): Magento\Ui\Controller\Adminhtml\Index\Render\Handle\Interceptor::execute
#26 vendor/magento/framework/App/Action/Action.php(111): Magento\Framework\App\Action\Action::dispatch
#25 vendor/magento/module-backend/App/AbstractAction.php(151): Magento\Backend\App\AbstractAction::dispatch
#24 vendor/magento/framework/Interception/Interceptor.php(58): Magento\Ui\Controller\Adminhtml\Index\Render\Handle\Interceptor::___callParent
#23 vendor/magento/framework/Interception/Interceptor.php(138): Magento\Ui\Controller\Adminhtml\Index\Render\Handle\Interceptor::Magento\Framework\Interception\{closure}
#22 vendor/weltpixel/m2-weltpixel-backend/Plugin/Utility.php(76): WeltPixel\Backend\Plugin\Utility::aroundDispatch
#21 vendor/magento/framework/Interception/Interceptor.php(135): Magento\Ui\Controller\Adminhtml\Index\Render\Handle\Interceptor::Magento\Framework\Interception\{closure}
#20 vendor/weltpixel/m2-weltpixel-backend/Plugin/Utility.php(76): WeltPixel\Backend\Plugin\Utility::aroundDispatch
#19 vendor/magento/framework/Interception/Interceptor.php(135): Magento\Ui\Controller\Adminhtml\Index\Render\Handle\Interceptor::Magento\Framework\Interception\{closure}
#18 vendor/magento/module-backend/App/Action/Plugin/Authentication.php(143): Magento\Backend\App\Action\Plugin\Authentication::aroundDispatch
#17 vendor/magento/framework/Interception/Interceptor.php(135): Magento\Ui\Controller\Adminhtml\Index\Render\Handle\Interceptor::Magento\Framework\Interception\{closure}
#16 vendor/magento/framework/Interception/Interceptor.php(153): Magento\Ui\Controller\Adminhtml\Index\Render\Handle\Interceptor::___callPlugins
#15 /Magento/Ui/Controller/Adminhtml/Index/Render/Handle/Interceptor.php(32): Magento\Ui\Controller\Adminhtml\Index\Render\Handle\Interceptor::dispatch
#14 vendor/magento/framework/App/FrontController.php(186): Magento\Framework\App\FrontController::processRequest
#13 vendor/magento/framework/App/FrontController.php(118): Magento\Framework\App\FrontController::dispatch
#12 vendor/magento/framework/Interception/Interceptor.php(58): Magento\Framework\App\FrontController\Interceptor::___callParent
#11 vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\App\FrontController\Interceptor::Magento\Framework\Interception\{closure}
#10 vendor/magento/framework/Interception/Interceptor.php(153): Magento\Framework\App\FrontController\Interceptor::___callPlugins
#9 /Magento/Framework/App/FrontController/Interceptor.php(23): Magento\Framework\App\FrontController\Interceptor::dispatch
#8 vendor/magento/framework/App/Http.php(116): Magento\Framework\App\Http::launch
#7 vendor/magento/framework/Interception/Interceptor.php(58): Magento\Framework\App\Http\Interceptor::___callParent
#6 vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\App\Http\Interceptor::Magento\Framework\Interception\{closure}
#5 vendor/justbetter/magento2-sentry/Plugin/GlobalExceptionCatcher.php(58): JustBetter\Sentry\Plugin\GlobalExceptionCatcher::aroundLaunch
#4 vendor/magento/framework/Interception/Interceptor.php(135): Magento\Framework\App\Http\Interceptor::Magento\Framework\Interception\{closure}
#3 vendor/magento/framework/Interception/Interceptor.php(153): Magento\Framework\App\Http\Interceptor::___callPlugins
#2 /Magento/Framework/App/Http/Interceptor.php(23): Magento\Framework\App\Http\Interceptor::launch
#1 vendor/magento/framework/App/Bootstrap.php(263): Magento\Framework\App\Bootstrap::run
#0 pub/index.php(29): null
rafallmmw commented 3 years ago

Hello,

we have this same problem. All our magento 2.4.2 and 2.4.2-p1 commerce editions projects which use smile are affected.

I updated smile to the newest version but it didn't help.

Do you know more or less when the fix will be available ? Our customers need that feature :(

jean-bernard-valentaten commented 3 years ago

Hi,

we also ran into this problem and could find out, that this happens due to the file catalogstaging_category_update_form.xml missing in the subpackage smile/module-elasticsuite-virtual-category. As of Magento Commerce Edition 2.4.2 the existence of this file is mandatory. I tried to solve the issue by copying vendor/smile/elasticsuite/src/module-elasticsuite-virtual-category/view/adminhtml/ui_component/category_form.xml to vendor/smile/elasticsuite/src/module-elasticsuite-virtual-category/view/adminhtml/ui_component/catalogstaging_category_update_form.xml but this led to other issues that would take more time to investigate upon (which I unfortunately cannot invest right now). Hope this information helps you solve the issue.

jsifuentes commented 3 years ago

Hi, just adding our note that we've also run into the same issue on 2.4.2-p2 Enterprise when attempting to add a scheduled update to a category. We opted to writing a patch file that removes the category_form.xml file during build to unbreak the feature until this is resolved.

WaPoNe commented 2 years ago

Adobe Commerce 2.4.2-p1 and 2.4.3-p1 Updated ElasticSuite to the last version, 2.10.8.1 The message: The "componentType" configuration parameter is required for the "assign_products" component. has disappeared from the system.log but now I read: The "componentType" configuration parameter is required for the "sw-menu" component. So I added this:

        if (isset($meta['sw-menu'])) {
            unset($meta['sw-menu']);
        }

to Smile\ElasticsuiteVirtualCategory\Plugin\Staging\Catalog\Category\DataProviderPlugin::aroundGetMeta((CategoryDataProvider $dataProvider, \Closure $proceed))

Again, The message: The "componentType" configuration parameter is required for the "sw-menu" component. has disappeared from the system.log but now I read: The "componentType" configuration parameter is required for the "onepage_category" component.

So I added this:

        if (isset($meta['onepage_category'])) {
            unset($meta[onepage_category']);
        }

to Smile\ElasticsuiteVirtualCategory\Plugin\Staging\Catalog\Category\DataProviderPlugin::aroundGetMeta((CategoryDataProvider $dataProvider, \Closure $proceed))

Now it works fine.

But is it the right solution? Can I remove sw-menu and _onepagecategory component? @romainruaud

romainruaud commented 2 years ago

This seems to be ok for me, I'm not sure what are those "sw-menu" and "onepage_category" fields, are they new things introduced recently by Magento or are they custom components developed specifically for your project ?

Regards

WaPoNe commented 2 years ago

@romainruaud you're right! They are custom components. Thank you

GrzegorzKrauze commented 1 year ago

Hi! I've just experienced this issue with a custom fieldset in category_form.xml. I've solved it by adding this fieldset explicitly to the catalogstaging_category_update_form.xml

<form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
    <fieldset name="campaign" /> 
</form>

Without it I've experienced error:


report.ERROR: The "componentType" configuration parameter is required for the "bohus_campaign" component. []