magento / magento2

Prior to making any Submission(s), you must sign an Adobe Contributor License Agreement, available here at: https://opensource.adobe.com/cla.html. All Submissions you make to Adobe Inc. and its affiliates, assigns and subsidiaries (collectively “Adobe”) are subject to the terms of the Adobe Contributor License Agreement.
http://www.magento.com
Open Software License 3.0
11.55k stars 9.32k forks source link

Products in Page Builder stopped working #38942

Closed adamlavery closed 3 months ago

adamlavery commented 3 months ago

Preconditions and environment

CE 2.4.6

Steps to reproduce

Open a Page Builder element that shows products e.g. content block using the Products content. In our case the products show correctly on the frontend but we get an error in the backend.

Expected result

Products display in Page Builder, as they used to.

Actual result

image

image

1 exception(s):
Exception #0 (Exception): Warning: Undefined array key "default" in .../vendor/magento/module-page-builder/Model/Stage/RendererPool.php on line 44

Exception #0 (Exception): Warning: Undefined array key "default" in .../vendor/magento/module-page-builder/Model/Stage/RendererPool.php on line 44
<pre>#1 Magento\PageBuilder\Model\Stage\RendererPool->getRenderer() called at [vendor/magento/module-page-builder/Controller/Adminhtml/Stage/Preview.php:62]
#2 Magento\PageBuilder\Controller\Adminhtml\Stage\Preview->Magento\PageBuilder\Controller\Adminhtml\Stage\{closure}() called at [vendor/magento/module-page-builder/Model/Stage/Preview.php:122]
#3 Magento\PageBuilder\Model\Stage\Preview->Magento\PageBuilder\Model\Stage\{closure}()
#4 call_user_func_array() called at [vendor/magento/framework/App/State.php:187]
#5 Magento\Framework\App\State->emulateAreaCode() called at [vendor/magento/module-page-builder/Model/Stage/Preview.php:130]
#6 Magento\PageBuilder\Model\Stage\Preview->startPreviewMode() called at [vendor/magento/module-page-builder/Controller/Adminhtml/Stage/Preview.php:66]
#7 Magento\PageBuilder\Controller\Adminhtml\Stage\Preview->execute() called at [vendor/magento/framework/Interception/Interceptor.php:58]
#8 Magento\PageBuilder\Controller\Adminhtml\Stage\Preview\Interceptor->___callParent() called at [vendor/magento/framework/Interception/Interceptor.php:138]
#9 Magento\PageBuilder\Controller\Adminhtml\Stage\Preview\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/magento/framework/Interception/Interceptor.php:153]
#10 Magento\PageBuilder\Controller\Adminhtml\Stage\Preview\Interceptor->___callPlugins() called at [generated/code/Magento/PageBuilder/Controller/Adminhtml/Stage/Preview/Interceptor.php:23]
#11 Magento\PageBuilder\Controller\Adminhtml\Stage\Preview\Interceptor->execute() called at [vendor/magento/framework/App/Action/Action.php:111]
#12 Magento\Framework\App\Action\Action->dispatch() called at [vendor/magento/module-backend/App/AbstractAction.php:151]
#13 Magento\Backend\App\AbstractAction->dispatch() called at [vendor/magento/framework/Interception/Interceptor.php:58]
#14 Magento\PageBuilder\Controller\Adminhtml\Stage\Preview\Interceptor->___callParent() called at [vendor/magento/framework/Interception/Interceptor.php:138]
#15 Magento\PageBuilder\Controller\Adminhtml\Stage\Preview\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/magento/module-backend/App/Action/Plugin/Authentication.php:145]
#16 Magento\Backend\App\Action\Plugin\Authentication->aroundDispatch() called at [vendor/magento/framework/Interception/Interceptor.php:135]
#17 Magento\PageBuilder\Controller\Adminhtml\Stage\Preview\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/magento/framework/Interception/Interceptor.php:153]
#18 Magento\PageBuilder\Controller\Adminhtml\Stage\Preview\Interceptor->___callPlugins() called at [generated/code/Magento/PageBuilder/Controller/Adminhtml/Stage/Preview/Interceptor.php:32]
#19 Magento\PageBuilder\Controller\Adminhtml\Stage\Preview\Interceptor->dispatch() called at [vendor/magento/framework/App/FrontController.php:245]
#20 Magento\Framework\App\FrontController->getActionResponse() called at [vendor/magento/framework/App/FrontController.php:212]
#21 Magento\Framework\App\FrontController->processRequest() called at [vendor/magento/framework/App/FrontController.php:147]
#22 Magento\Framework\App\FrontController->dispatch() called at [vendor/magento/framework/Interception/Interceptor.php:58]
#23 Magento\Framework\App\FrontController\Interceptor->___callParent() called at [vendor/magento/framework/Interception/Interceptor.php:138]
#24 Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/m2epro/magento2-extension/Plugin/HealthStatus/Magento/Framework/App/FrontController.php:76]
#25 Ess\M2ePro\Plugin\HealthStatus\Magento\Framework\App\FrontController->processDispatch() called at [vendor/m2epro/magento2-extension/Plugin/AbstractPlugin.php:42]
#26 Ess\M2ePro\Plugin\AbstractPlugin->execute() called at [vendor/m2epro/magento2-extension/Plugin/HealthStatus/Magento/Framework/App/FrontController.php:40]
#27 Ess\M2ePro\Plugin\HealthStatus\Magento\Framework\App\FrontController->aroundDispatch() called at [vendor/magento/framework/Interception/Interceptor.php:135]
#28 Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/magento/framework/Interception/Interceptor.php:153]
#29 Magento\Framework\App\FrontController\Interceptor->___callPlugins() called at [generated/code/Magento/Framework/App/FrontController/Interceptor.php:23]
#30 Magento\Framework\App\FrontController\Interceptor->dispatch() called at [vendor/magento/framework/App/Http.php:116]
#31 Magento\Framework\App\Http->launch() called at [vendor/magento/framework/App/Bootstrap.php:264]
#32 Magento\Framework\App\Bootstrap->run() called at [pub/index.php:30]
</pre>

Additional information

This used to work - clearly because we show the products on the frontend:

image

Release note

Fix yet another bug that wasn't present but is now!

Triage and priority

m2-assistant[bot] commented 3 months ago

Hi @adamlavery. Thank you for your report. To speed up processing of this issue, make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, Add a comment to the issue:

m2-assistant[bot] commented 3 months ago

Hi @engcom-Bravo. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

adamlavery commented 3 months ago

@magento give me 2.4-develop instance

magento-deployment-service[bot] commented 3 months ago

Hi @adamlavery. Thank you for your request. I'm working on Magento instance for you.

magento-deployment-service[bot] commented 3 months ago

Hi @adamlavery, here is your Magento Instance: https://622539b936527028c169118fa5fdfcf8.instances-prod.magento-community.engineering Admin access: https://622539b936527028c169118fa5fdfcf8.instances-prod.magento-community.engineering/admin_3f9d Login: 2871394a Password: 1befcf49802e

adamlavery commented 3 months ago

Not reprodcible on vanilla install. Is this something that has already been raised and fixed? A variety of searches found nothing on this.

engcom-Bravo commented 3 months ago

Hi @adamlavery,

Thanks for your reporting and collaboration.

We have also verified the issue in Latest 2.4-develop instance and the issue is not reproducible.

As per this comment https://github.com/magento/magento2/issues/38942#issuecomment-2233056586 we are closing this issue.please feel free to reopen the issue and update the description accordingly.

Thanks.

MaximSR commented 3 months ago

@adamlavery

I encountered the same bug, and it appears to be associated with the blog module. The issue stems from having a separate DI (Dependency Injection) setup for Magento\PageBuilder\Model\Stage\RendererPool within the blog module, which is currently defined in adminhtml/di.xml, resulting in an exception.|

To resolve this, I transferred the DI configuration within the blog module to etc/di.xml. To the same scope as Magento has it.

adamlavery commented 3 months ago

Thanks @MaximSR, the Magezon Blog extension is the cause of this. I will raise this with them - guess you have as well? While it now doesn't crash, the layout is wrong in PageBuilder. I'm guessing they did something for their page builder which has broken native Magento page builder.

adamlavery commented 3 months ago

Magezon will soon be releasing a fix for this but in the meantime make the following mod to \Magezon\Blog\etc\adminhtml\di.xml

    <type name="Magento\PageBuilder\Model\Stage\RendererPool">
        <arguments>
            <argument name="renderers" xsi:type="array">
                <item name="blog_posts" xsi:type="object">Magento\PageBuilder\Model\Stage\Renderer\WidgetDirective</item>
                <item name="products" xsi:type="object">Magento\PageBuilder\Model\Stage\Renderer\WidgetDirective</item>
            </argument>
        </arguments>
    </type>