magento2 icon indicating copy to clipboard operation
magento2 copied to clipboard

Block preview in page builder broken for blocks that do not belong in the default strore.

Open TheBadong opened this issue 3 years ago • 16 comments

Preconditions and environment

Magento ver. 2.4.3-p2

Steps to reproduce

  1. Have a magento instance with at least two stores
  2. Create a cms block only visible in the store that is not the default store
  3. Create a cms page in on of the two stores (doesn't matter which one)
  4. Add the cms block you created, in the page through the page builder.

Expected result

Block preview should render

Actual result

No block preview is rendered Screenshot 2022-10-28 at 12 57 05

Additional information

From my research, i found that the code goes through this file vendor/magento/module-cms/Block/Widget/Block.php(131) and gets sets the default store id on the block it's trying to fetch. It then tries to look for the block from the other store with the wrong store id, and does not find it here vendor/magento/module-cms/Model/ResourceModel/Block.php(121). The block is not loaded and the preview is blank.

Note that only the preview in the page builder is broken, the page renders correctly on the frontend.

Release note

No response

Triage and priority

  • [X] Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • [ ] Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • [ ] Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • [ ] Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • [ ] Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.

TheBadong avatar Oct 28 '22 11:10 TheBadong

Hi @TheBadong. Thank you for your report. To speed up processing of this issue, make sure that you provided the following information:

  • Summary of the issue
  • Information on your environment
  • Steps to reproduce
  • Expected and actual results

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:

@magento give me 2.4-develop instance - upcoming 2.4.x release

For more details, review the Magento Contributor Assistant documentation.

Add a comment to assign the issue: @magento I am working on this

To learn more about issue processing workflow, refer to the Code Contributions.


:warning: According to the Magento Contribution requirements, all issues must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting.

:clock10: You can find the schedule on the Magento Community Calendar page.

:telephone_receiver: The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, join the Community Contributions Triage session to discuss the appropriate ticket.

:pencil2: Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel

m2-assistant[bot] avatar Oct 28 '22 11:10 m2-assistant[bot]

@magento give me 2.4-develop instance

TheBadong avatar Oct 28 '22 11:10 TheBadong

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

Hi @TheBadong, here is your Magento Instance: https://fde56b008b77c88efc9ac1348a092fde.instances.magento-community.engineering Admin access: https://fde56b008b77c88efc9ac1348a092fde.instances.magento-community.engineering/admin_7ba5 Login: a3a7275d Password: 2e76b7ced467

Just tested and reproduced on this instance image

TheBadong avatar Oct 28 '22 11:10 TheBadong

Hi @engcom-November. 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:

  • [ ] 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).

    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.

  • [ ] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • [ ] 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • [ ] 4. Verify that the issue is reproducible on 2.4-develop branch

    Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

  • [ ] 5. Add label Issue: Confirmed once verification is complete.

  • [ ] 6. Make sure that automatic system confirms that report has been added to the backlog.

m2-assistant[bot] avatar Nov 02 '22 06:11 m2-assistant[bot]

@magento give me 2.4-develop instance

engcom-November avatar Nov 03 '22 03:11 engcom-November

Hi @engcom-November. Thank you for your request. I'm working on Magento instance for you.

Hi @engcom-November, here is your Magento Instance: https://fde56b008b77c88efc9ac1348a092fde.instances.magento-community.engineering Admin access: https://fde56b008b77c88efc9ac1348a092fde.instances.magento-community.engineering/admin_8f39 Login: 8a5519f9 Password: 843138d415f4

Verified the issue on Magento 2.4-develop instance and is reproducible. Hence confirming this issue. image

engcom-November avatar Nov 03 '22 03:11 engcom-November

:white_check_mark: Jira issue https://jira.corp.adobe.com/browse/AC-6968 is successfully created for this GitHub issue.

github-jira-sync-bot avatar Nov 03 '22 03:11 github-jira-sync-bot

:white_check_mark: Confirmed by @engcom-November. Thank you for verifying the issue.
Issue Available: @engcom-November, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

m2-assistant[bot] avatar Nov 03 '22 03:11 m2-assistant[bot]

@magento I am working on this

rostilos avatar Nov 12 '22 08:11 rostilos

The problem comes from the way the block is loaded:

  • pagebuilder do an ajax call to https://your.magento.com/admin/pagebuilder/stage/preview/key//?isAjax=true with a payload containing the block_id (there is no store_id in it)
  • in \Magento\PageBuilder\Model\Stage\Preview::startPreviewMode, it loads the block using the default store of your environnement regardless the attached website

But how to do it properly ? If your cms page is in 2 different websites and the block_id referers 2 different blocks (one on each website) : which one to display to render it in admin ?

Dnd-Mafer avatar Apr 09 '24 08:04 Dnd-Mafer

@Dnd-Mafer rendering a block by ID should always be possible since that's a unique key. Using an identifier is different, that identifier can be used for different stores (can't overlap).

I can't reproduce this issue at the moment, although we have several other issues with previews of CMS blocks not working, this ain't one.

Update: I was wrong. Apparently one of the default storeviews was selected, I thought you referred to selecting "all store views".

debuysserk avatar Oct 18 '24 13:10 debuysserk

How come this issue is still in the backlog? The entire multi language store view setup is borked with CMS blocks on several points.

  1. the inability to select a CMS block based on an identifier instead of a block id. When you have a store independent CMS page but you insert a store specific CMS block with the pagebuilder component, that's a no go because it only saves the ID. Same with the widget through Text Component but at least you can change the block id there to a identifier through the html code view (although the html code view was enabled by us in our own module...)
  2. the inability to preview CMS blocks selected by id's not on the default store view like in this case.

Content is such a big deal right now that we're having a hard time explaining our clients to just duplicate the CMS pages in this case just to make this work.

debuysserk avatar Oct 18 '24 14:10 debuysserk

Hi @TheBadong,

Thanks for your reporting and collaboration.

We have tried to reproduce the issue in Latest 2.4-develop instance and the issue is reproducible.Kindly refer the screenshots.

Image

No block preview is rendered

Hence Confirming the issue.

Thanks.

engcom-Bravo avatar Jan 24 '25 06:01 engcom-Bravo

:x: Cannot export the issue. This GitHub issue is already linked to Jira issue(s): https://jira.corp.adobe.com/browse/AC-6968

github-jira-sync-bot avatar Jan 24 '25 06:01 github-jira-sync-bot

Hello,

For information, here is the response received from Adobe Commerce Core Team through Adobe Enterprise support... :

Not a Bug

because

Preview of CMS pages/blocks works only on default store view because those entities don't support the scope (there is no store view switcher like on Dynamic Blocks or Products).

MaximeChamont avatar Oct 06 '25 13:10 MaximeChamont