Magento Module: Insert Product Attribute into a Page Builder Template
- Compatibility
- 2.4.8, 2.4.7, 2.4.6
Description / Magento Module: Insert Product Attribute into a Page Builder Template
Product Data Anywhere in the Template
Kowal InsertProductAttributeInToTemplate lets you insert data from the current product into content created in the Magento editor, including Page Builder description templates. A shared layout can display different text and images depending on the product currently being viewed.
Instead of duplicating content across multiple descriptions, you can save it in product attributes and select the appropriate field in the widget.
Two Widgets for Building Content
- Insert Custom Description: retrieves the value of a selected attribute for the current product. The selection list includes text, textarea, price, and weight fields; the main description attribute is excluded from the textarea options.
- Insert Image: displays an image from a selected media_image attribute.
- Image settings: CSS class, image size, zoom size, and the option to open the full-size image when clicked.
- Content processing: the description value is processed by the Magento CMS filter, allowing it to handle any directives and widgets it contains.
Additional Main Description Field
During installation, the module adds the main_description product attribute with the Main descriptionlabel. It is an optional textarea field in the Content group, with values that can vary by store view.
You can use it for an additional section of the description and place its content in a selected part of the template using Insert Custom Description.
How to Prepare a Template
- Complete the selected text or image fields for your products.
- Insert the Insert Custom Description or Insert Image widget in the appropriate location within the Magento editor content.
- Select the attribute and, for an image, configure the display settings.
- Save the content and review the result on the product page.
The widgets use the current product context. Values are retrieved from its data; an empty description field returns empty content, while no image is displayed if an image has not been selected. Use of the widgets requires a page where the product context is available.
Installation
Composer package: kowal/module-insertproductattributeintotemplate; module: Kowal_InsertProductAttributeInToTemplate. Installation from a ZIP file in app/code/Kowal/InsertProductAttributeInToTemplate.
After installation, enable the module with php bin/magento module:enable Kowal_InsertProductAttributeInToTemplate, run php bin/magento setup:upgrade , and clear the cache with php bin/magento cache:flush. In production, follow the Magento deployment procedure; the documentation specifies the --keep-generated option for updates.
More Information
| Theme compatibility | Luma / Blank, KOWAL |
|---|
Questions and Answers
Can I drag a block in Page Builder and specify which product attribute should be displayed in it?
Is there a configuration that allows you to specify default text or a value when an attribute is empty?
Does the module also work for different store views (multi-store) and different languages?
Does installing the module require modifying Magento core files or theme files?
Can I use an attribute value in SEO or marketing content (e.g., “Material: X”) in a Page Builder block without having to manually edit each product?
Does this negatively affect the store’s performance?
Can I customize the display style of the attribute value (color, font, layout) in the Page Builder block?
Does the module support / work with Page Builder available by default in Magento 2 (Commerce) or as an add-on in the Community version?
Do I receive technical support and updates after purchasing the module?
Module Installation Instructions
Installation
* In a production environment, please use the option --keep-generated
Type: Composer
-
The module is available in the Composer repository:
- Private GitLab repository:
https://gitlab.com
- Private GitLab repository:
-
Add the Composer repository to your configuration:
composer config repositories.insert.product.attribute.template vcs https://gitlab.com/magento2ext/insert-product-attribute-in-to-template -
Add the access token for the private GitLab repository:
composer config --auth gitlab-token.gitlab.com <TWÓJ_TOKEN> -
Install the module using Composer:
composer require kowal/module-insertproductattributeintotemplate -
Apply the database updates:
php bin/magento setup:upgrade -
Clear the cache:
php bin/magento cache:flush