Hi, I'm working on a task with related products. What I want to achieve is it no related products are set up for a given product then all products in the same product group should be displayed as related products. I have change the related products code in the product template to add GroupId to the feed url if nothing found in the related product loop. The first 4 products returned from the feed are correct but when using next button on the productpage the feed returns all products and not products in the group. The repository query contains a parameter for groupid – any suggestions?
if (GetLoop("ProductRelatedGroups").Count > 0)
{
foreach (LoopItem relatedGroup in GetLoop("ProductRelatedGroups"))
{
string relatedGroupId = ToPascalCase(relatedGroup.GetString("Ecom:Product:RelatedGroup.Name"));
string relatedFeed = feedFullUrl + "&" + relatedGroupId + "=" + productId + "&GroupName=" + relatedGroupId;
ProductSection relatedSectionObject = new ProductSection();
relatedSectionObject.name = relatedGroup.GetString("Ecom:Product:RelatedGroup.Name");
relatedSectionObject.id = relatedGroupId;
if (relatedProductsLayout != "top")
{
relatedSectionObject.helper = @RelatedProducts(relatedSectionObject.name, relatedGroupId, relatedFeed);
}
else
{
relatedSectionObject.helper = @RelatedProductsMini(relatedSectionObject.name, relatedGroupId, relatedFeed);
}
relatedSectionObject.layoutType = relatedProductsLayout;
productSectionsList.Add(relatedSectionObject);
}
}
else
{
//activity = GetString("Ecom:Product:Field.Activity");
string relatedGroupId = ToPascalCase(HttpContext.Current.Request.QueryString.Get("GroupID"));
string relatedId = relatedGroupId.ToUpper();
string relatedFeed = feedFullUrl + "&" + relatedGroupId + "=" + productId + "&GroupID=" + relatedId;
ProductSection relatedSectionObject = new ProductSection();
relatedSectionObject.name = Translate("Related product by activity");
relatedSectionObject.id = relatedGroupId;
if (relatedProductsLayout != "top")
{
relatedSectionObject.helper = @RelatedProductsGroup(relatedSectionObject.name, relatedId, relatedFeed);
}
else
{
relatedSectionObject.helper = @RelatedProductsGroupMini(relatedSectionObject.name, relatedGroupId, relatedFeed);
}
relatedSectionObject.layoutType = relatedProductsLayout;
productSectionsList.Add(relatedSectionObject);
}