kowal.info

Insert Product Attribute Into Template

Composer kowal/module-insertproductattributeintotemplate · Version 1.0.25

Product page

Insert Product Attribute Into Template — kowal.co

Description

Embeds text or an image from the current product’s attributes into its product page content.

For whom

For editors who build a shared Page Builder layout and want the content to vary with each product.

Features

  • Insert Custom Description widget for description attributes.
  • Insert Image widget with image attribute, size and CSS class options.
  • Optional click-to-enlarge behaviour.

Installation

From the Magento root, with Composer access to the Kowal package, run

composer require kowal/module-insertproductattributeintotemplate
bin/magento module:enable Kowal_InsertProductAttributeInToTemplate
bin/magento setup:upgrade
bin/magento cache:clean

Configuration

  1. Populate a description or image attribute on a test product.
  2. In an editor that supports Magento widgets, insert Insert Custom Description or Insert Image and select the matching attribute.
  3. For images, choose the display size. If you enable Display full image on click?, choose the enlarged size too. Save and open the product page.

Requirements / notes

The widget reads the current product at render time. Place it in content rendered in the context of a product page.

FAQ

Why is the description empty or showing “No product!”?

An empty attribute produces an empty description. The message means there is no current product, as can happen on a standalone CMS page.

Verify the installation

bin/magento module:status Kowal_InsertProductAttributeInToTemplate

Place the same description widget on two product pages with different attribute values. Compare the output. For the image widget, also check the enlarged view if enabled.