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.57k stars 9.32k forks source link

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

Open TheBadong opened 2 years ago

TheBadong commented 2 years ago

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

m2-assistant[bot] commented 2 years ago

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

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.


: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

TheBadong commented 2 years ago

@magento give me 2.4-develop instance

magento-deployment-service[bot] commented 2 years ago

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

magento-deployment-service[bot] commented 2 years ago

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

TheBadong commented 2 years ago

Just tested and reproduced on this instance image

m2-assistant[bot] commented 2 years ago

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:

engcom-November commented 2 years ago

@magento give me 2.4-develop instance

magento-deployment-service[bot] commented 2 years ago

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

magento-deployment-service[bot] commented 2 years ago

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

engcom-November commented 2 years ago

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

github-jira-sync-bot commented 2 years ago

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

m2-assistant[bot] commented 2 years ago

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

rostilos commented 2 years ago

@magento I am working on this

Dnd-Mafer commented 7 months ago

The problem comes from the way the block is loaded:

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 ?

debuysserk commented 1 month ago

@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 commented 1 month ago

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.