Developer forum

Forum » Rapido » Adding Product Group Images to the repository?

Adding Product Group Images to the repository?

Aki Ruuskanen
Aki Ruuskanen
Reply

I can't figure out how to add product group images to the jsonfeed for a productlist. "Group Name"," Group Description" is there but no the image fields for groups. 

My guess is that I need to add the image fields to the repository. But I cant see how? 

    Root feedRoot = new Root();
    feedRoot.currentPage = GetString("Ecom:ProductList.CurrentPage");
    feedRoot.totalPages = GetString("Ecom:ProductList.TotalPages");
    feedRoot.pageSize = GetString("Ecom:ProductList.PageSize");
    feedRoot.header = pageName;
    feedRoot.description = GetString("Ecom:Group.Description");
    // How to accomplish this?
    feedRoot.largeImage = GetString("Ecom:Group.LargeImage");
    feedRoot.smallImage = GetString("Ecom:Group.SmallImage");
    feedRoot.id = GetString("Ecom:Group.ID");    
    feedRoot.headerIcon = HttpContext.Current.Request.QueryString.Get("ListName") != null ? "fa fa-star u-margin-right" : "";

 

Regards / Aki

 


Replies

 
Karsten Thuen Dynamicweb Employee
Karsten Thuen
Reply
This post has been marked as an answer

Hi Aki

I have no problems getting this to work. In Dynamicwe, try to go to Ecommerce, locate the product group that you need the image on. And the click "Edit group" in the ribbon bar. Check that you have chosen the images you want to be shown in the frontend.

While testing this, it might be a great idea to start by testing your JSON feeds. Open the page that use the feed in the frontend. For example the product catalog. Then to do this, open the console in your browser. Click "Network" and filter on "XHR" then you have a list of the referenced feeds. Right click and open the feed you want to investigate in a new tab. 

To make it easier to read the feed and validate it, you may copy it and paste it into the tool on this site https://jsonlint.com/  And click validate.

 

Best regards
Karsten Thuen

Votes for this answer: 1
 
Aki Ruuskanen
Aki Ruuskanen
Reply

Thanks. Didn't think of the inspector thing. 

Attached the output from the inspector. The image fields are empty. The ID , header (Group name), and description works.

Code from AjaxProductList.cshtml:

    feedRoot.description = GetString("Ecom:Group.Description");  <- Works
    feedRoot.largeImage = GetString("Ecom:Group.LargeImage");  <- Not working
    feedRoot.smallImage = GetString("Ecom:Group.SmallImage");  <- Not working
    feedRoot.id = GetString("Ecom:Group.ID"); <- Works

I added the group description, it was not there in standard Rapido and work as expected. But not with image fields. 

In the repository the Schema Extender contains fields "Group IDs", "Group names", "Group number" and "Group descriptions". My guess is I need to add "Group Images" (or something similar)? 

 

/Aki

 

Regards / Aki

 

json.JPG
 
Aki Ruuskanen
Aki Ruuskanen
Reply

Found the problem: Me. 

The image was added to another language layer than I was wokring on....    blush

/Aki

 

You must be logged in to post in the forum