Developer forum

Forum » Development » Details loop in a productlist

Details loop in a productlist

Alexander Tømmerholen
Reply

Hello,

We are experience some issues with the GetLoop("Details"). We are trying to create a JSON feed with product information and whitin this we want to get the documents under the section "Documents and files". The issues seems to be that we can not access the loop. The loop seems to work fine on a product page but not on a product list. Is it not possible to access this loop on a product list?

Or is there a other way to retrieve the information under the "Documents and files" section?

How the code is right now:

foreach (var product in products)
{
string prodName = product.GetString("Ecom:Product.Name");
string prodNumber = product.GetString("Ecom:Product.Number");
string prodElNumber =  product.GetString("Ecom:Product:Field.ItemNo2");
string prodImage = product.GetString("Product.ImageCustom");
string prodShortDescription = product.GetString("Ecom:Product.ShortDescription");
string prodLongDescription = product.GetString("Ecom:Product.LongDescription");
List<string> productDetailsList = new List<string>();
 
var details = product.GetLoop("Details"); 
        foreach (var item in details) 
        {
            string prodUserManuals = item.GetString("Ecom:Product:Detail.Link");
productDetailsList.Add(prodUserManuals);
        }
 
Product productObject = new Product();
productObject.Name = prodName;
productObject.Number = prodNumber;
productObject.ElNumber = prodElNumber;
productObject.Image = prodImage;
productObject.Details = productDetailsList;
productObject.ShortDescription = prodShortDescription;
productObject.LongDescription = prodLongDescription;
feedRoot.Products.Add(productObject);
}
 
 feedObject.Add(feedRoot);


Best Regards
Alexander


Replies

 
Nuno Aguiar Dynamicweb Employee
Nuno Aguiar
Reply

Hi Alexander,

 

I believe that for performance reasons that loop is not populated in a product list. If you really need that, I suggest you use the API to instantiate the product and then you should have access to all that information.

 

Again, beware of performance issues.

 

Best Regards,

Nuno Aguiar

 
Alexander Tømmerholen
Reply

Hi Nuno,

Yes, we was thinking that using the API would access the information we needed but we was afraid of the performance issue. Cross fingers that the performance won`t be to bad. Thank you for your answear.

Best Regards
​Alexander 

 

You must be logged in to post in the forum