Dynamic Text and Image as per the product type and product sub type that editor can maintain

Murugesan Manokaran asked on May 8, 2017 05:29

requirement: Editor will add Product Announcement with text and product image that must display on the product page and in the product child pages according to the type name.

What are the possible ways to achieve this?

Correct Answer

Trevor Fayas answered on May 8, 2017 16:17

Roman is refering to the "Show on Page Type" visibility setting on most repeaters.

Likewise, you can also make a repeater whose's transformation and "Page Type" is dynamic based on the current page.

If you use macros, you can pull in the current page's class name, and even use that in the transformation. Similar to this:

Page Type:  {% CurrentDocument.ClassName %}_Announcements
Transformation {% CurrentDocument.ClassName %}_Announcements.AnnouncementTransformation

That way if you have a product of class name "Product.Laptop" you can have an announcement of type "Product.Laptop_Announcement" somewhere on the content tree and it will use the transformation of "Product.Laptop_Announcement.AnnouncementTransformation", but if the product is a "Product.Computer", you can have a different announcement type of "Product.Computer_Announcements" to display.

Just have to be careful to make sure you only show this on the product types that you have the matching things configured ;)

0 votesVote for this answer Unmark Correct answer

Recent Answers


Roman Hutnyk answered on May 8, 2017 08:45

there are many ways to implement this... The easiest, probably, is to implement appropriate page type with text and image fields and store it under the product in content tree. Than use repeater or any other viewer web part to show them on the page.

2 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.