Developer forum

Forum » Ecommerce - Standard features » Render field content on the frontend

Render field content on the frontend

Caro De Weze
Reply

Hi,

I added a field at Product group fields (Settings > Ecommerce > Product catalog > Product group fields) called Product Group Bottom Description (Name = Product Group Bottom Description, System name = ProductGroupBottomDescription, Template tag = ProductGroupBottomDescription and Field type = Long Text). To show this I created Item type with a new template in Swift based on Swift_ProductListInfo.cshtml and added restrictions. This has allowed me to select the item type in the visual editor, so that works. The problem now is that I have not made the correct adjustment in the template, because I still see the description of the product group and not my ProductGroupBottomDescription. I think I need to adjust something on line 34, but I don't know exactly what. Can you help me?

Caro

 


Replies

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply
This post has been marked as an answer

Hi Caro

I think you need to change this line that takes the description from the regular field

string ProductGroupBottomDescription = productList?.Group?.Description != null ? productList.Group.Description : "";

To this that will find the value in your custom group field:

var bottomDescription = productList?.Group?.GroupFields?.FirstOrDefault(f => f.SystemName == "ProductGroupBottomDescription");
string groupDescription = bottomDescription != null ? bottomDescription.Value.ToString() : "";

BR Nicolai

Votes for this answer: 1

 

You must be logged in to post in the forum