Hi!
We have a magento 2.4.3 store front and I'm trying to make a change to a widget.
We have what we call a benefits bar, and I would like to link the text "Orders before 3pm" to another page on the website, I've tried to do this using both HTML tags and the insert variable tag but every time it breaks the bar. Any suggestions on how to get a link on text using page builder?
This is the bar:
This is the code:
Thanks in Advance.
Solved! Go to Solution.
Hello @kierandaym7fe9,
you're trying to add a hyperlink to the text "Orders Before 3pm" in the widget. This can be tricky in Magento's Page Builder, as it sometimes strips HTML when not used correctly. To ensure your link works without breaking the bar, follow this:
Try adding the link directly within the text. For example:
<p>{{widget type="Absolute\CustomWidgets\Block\Widget\PromotionalBannersWidget" banner_one_title="Free Delivery on Orders Over £150" banner_one_tagline="UK Mainland" banner_two_title="Orders Before 3pm" banner_two_tagline="<a href='/link-to-page'>Orders Before 3pm</a>" banner_three_title="Price Match Guarantee" banner_three_tagline="Lowest Prices"}}</p>
Make sure to replace /link-to-page with the actual URL path you want to link to.
If Page Builder is stripping HTML tags, try disabling WYSIWYG for that particular section while editing, and switch to raw HTML mode. This can often prevent Magento from removing valid tags.
If this approach doesn't work, it could be that your custom widget
Absolute\CustomWidgets\Block\Widget\PromotionalBannersWidget is sanitizing or not allowing HTML in its properties. If this is the case, you may need to adjust the widget code in your module by ensuring that the specific fields (banner_two_tagline, etc.) allow HTML input. For example, in your widget's block class, you might need to modify it to allow escapeHtml=false
This might be work.
If the issue will be resolved, Click Kudos & Accept as a Solution.
Go to Content > Pages or Blocks, or Content > Widgets if it's in a widget, and find the benefits bar to edit. Highlight "Orders before 3pm" in the Page Builder editor, click the Link icon, insert the URL, and choose whether it opens in the same tab or a new one.
Hello,
Thank you for coming back to me.
This isn't located in widgets and in the block only have the information from the screenshot. Do you have any other suggestions on how to do this?
Thanks
Hello @kierandaym7fe9,
you're trying to add a hyperlink to the text "Orders Before 3pm" in the widget. This can be tricky in Magento's Page Builder, as it sometimes strips HTML when not used correctly. To ensure your link works without breaking the bar, follow this:
Try adding the link directly within the text. For example:
<p>{{widget type="Absolute\CustomWidgets\Block\Widget\PromotionalBannersWidget" banner_one_title="Free Delivery on Orders Over £150" banner_one_tagline="UK Mainland" banner_two_title="Orders Before 3pm" banner_two_tagline="<a href='/link-to-page'>Orders Before 3pm</a>" banner_three_title="Price Match Guarantee" banner_three_tagline="Lowest Prices"}}</p>
Make sure to replace /link-to-page with the actual URL path you want to link to.
If Page Builder is stripping HTML tags, try disabling WYSIWYG for that particular section while editing, and switch to raw HTML mode. This can often prevent Magento from removing valid tags.
If this approach doesn't work, it could be that your custom widget
Absolute\CustomWidgets\Block\Widget\PromotionalBannersWidget is sanitizing or not allowing HTML in its properties. If this is the case, you may need to adjust the widget code in your module by ensuring that the specific fields (banner_two_tagline, etc.) allow HTML input. For example, in your widget's block class, you might need to modify it to allow escapeHtml=false
This might be work.
If the issue will be resolved, Click Kudos & Accept as a Solution.