Hello
We implemented a related products list and were later required to remove products that only belonged to the PIM shop.
We came out with the solution as you can see below but wondered if there's a more efficient way to do it. Basically we added the products from the Ecommerce shop to a list and validated if products from the loop were there:
BlocksPage customRelatedProductsPage = BlocksPage.GetBlockPage("Product"); var relatedProducts = new List<LoopItem>(); var shops = new Dynamicweb.Ecommerce.Shops.ShopService(); var eCommerceShopProducts = new List<string>(); foreach (var groupProd in shops.GetShop(Pageview.Area.EcomShopId).get_Groups(GetString("Ecom:Product.LanguageID"))) { foreach (var product in groupProd.Products) { eCommerceShopProducts.Add(product.Id); } } relatedProducts.AddRange(GetLoop("eCom:Related.CustomersWhoSawThisAlsoSaw").Where(p => eCommerceShopProducts.Contains(p.GetString("Ecom:Product.ID")))); relatedProducts.AddRange(GetLoop("eCom:Related.MostPopularProducts").Where(p => eCommerceShopProducts.Contains(p.GetString("Ecom:Product.ID")))); relatedProducts.AddRange(GetLoop("eCom:Related.WhatAboutTheseProducts").Where(p => eCommerceShopProducts.Contains(p.GetString("Ecom:Product.ID"))));