magento2
magento2 copied to clipboard
Product Alert Adding custom CMS blocks to mail template
Preconditions and environment
- Magento 2.4.4-p1
- php 8.1
Steps to reproduce
- Go to backend
- Create a cms block (Content > Blocks) > Add new Block > Edit with pagebuilder
- Add element named a HTML code
<table class="header-tabs" align="center">
<tbody>
<tr>
<td class="header-tab webshop">
<a href="{{config path="web/secure/base_url"}}"><b>test1</b></a>
</td>
<td class="header-tab service">
<a href="{{config path="web/secure/base_url"}}test2"><b>test2</b></a>
</td>
<td class="header-tab faq">
<a href="{{config path="web/secure/base_url"}}test3"><b>test3</b></a>
</td>
</tr>
</tbody>
</table>
- add identifier "custom"
- Enable back in stock
- Go to marketing > Email templates
- Add new template > load template "Stock Alert"
- Add this in the content {{block class="Magento\Cms\Block\BlockByIdentifier" area='frontend' identifier="custom"}}
- Enable stock alert
- Create customer account
- subscribe to stock alert for out of stock product.
- Make the product back in stock
Expected result
The block "custom" gets rendered as html.
Actual result
The block "custom" gets rendered as text and you see the whole html tags rendered as text.
Additional information
Product alert now uses queues in magento 2.4.4 while before it used crons.
Because it now uses queues it does not have an area, since queue's in most cases use AREA global, because it uses the area global it does not get to use the plugin \Magento\PageBuilder\Plugin\Filter\TemplatePlugin of pagebuilder. This plugin is responsible of making encoded html and decodes it. By adding this patch the problem is resolved.
diff --git a/vendor/magento/module-page-builder/etc/di.xml b/vendor/magento/module-page-builder/etc/di.xml
--- a/vendor/magento/module-page-builder/etc/di.xml
+++ b/vendor/magento/module-page-builder/etc/di.xml (date 1663074045963)
@@ -450,4 +450,7 @@
</argument>
</arguments>
</virtualType>
+ <type name="Magento\Framework\Filter\Template">
+ <plugin name="convertBackgroundImages" type="Magento\PageBuilder\Plugin\Filter\TemplatePlugin"/>
+ </type>
</config>
Release note
No response
Triage and priority
- [ ] 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.
- [X] 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”.
Hi @leonhelmus. 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.
- Join Magento Community Engineering Slack and ask your questions in #github channel.
: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
@magento give me 2.4-develop instance
Hi @engcom-Dash. Thank you for your request. I'm working on Magento instance for you.
Hi @engcom-Dash, here is your Magento Instance: https://48bfef7cf8b7230a6dc329376a6db94d.instances.magento-community.engineering Admin access: https://48bfef7cf8b7230a6dc329376a6db94d.instances.magento-community.engineering/admin_d807 Login: 4e0fd3ff Password: 3e99ccd018d9
Hi @engcom-Dash. 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:
-
- Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
Details
If the issue has a valid description, the labelIssue: Format is valid
will be added to the issue automatically. Please, edit issue description if needed, until labelIssue: Format is valid
appears.
- Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
-
- 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.
- Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add
-
- Add
Component: XXXXX
label(s) to the ticket, indicating the components it may be related to.
- Add
-
- Verify that the issue is reproducible on
2.4-develop
branchDetails
- Add the comment@magento give me 2.4-develop instance
to deploy test instance on Magento infrastructure.
- If the issue is reproducible on2.4-develop
branch, please, add the labelReproduced 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!
- Verify that the issue is reproducible on
- Join Magento Community Engineering Slack and ask your questions in #github channel.
Hi @leonhelmus ,
We are trying to reproduce the issue in 2.4-develop branch and 2.4.4 also we are not able to reproduce the issue. we are getting The block "custom" gets rendered as html.
For your reference i attached the screenshots:
Steps to reproduce:
Go to back-end Create a cms block (Content > Blocks) > Add new Block > Edit with page builder Add element named a HTML coded identifier "custom" Enable back in stock Go to marketing > Email templates Add new template > load template "Stock Alert" Add this in the content which is provided Enable stock alert Create customer account subscribe to stock alert for out of stock product.
Let us know if we are Missing anything!!!
Thnaks!!!!
@engcom-Dash could it be that the feature environment for the product elart queue has an area, because our queue uses global and that's why that patch is needed.
We added the static block in this way {{block or are you using a widget?
@magento give me 2.4-develop instance
Hi @engcom-Dash. Thank you for your request. I'm working on Magento instance for you.
Hi @engcom-Dash, here is your Magento Instance: https://48bfef7cf8b7230a6dc329376a6db94d.instances.magento-community.engineering Admin access: https://48bfef7cf8b7230a6dc329376a6db94d.instances.magento-community.engineering/admin_80be Login: 4ef7c1b1 Password: 0fdbd3bb12ca
Hi @leonhelmus ,
As per description we are added block...and we are getting the result is "The block "custom" gets rendered as html".
Let us know if we missing anything!!!
Thanks!!!
Hi @leonhelmus ,
Thanks for your Contribution!
We have noticed that this issue has not been updated for a period of 14 Days. Hence we assume that this issue is fixed now, so we are closing it. Please raise a fresh ticket or reopen this ticket if you need more assistance on this.
Thanks !!!