Skip to content

Open-source eCommerce platform for C# and ASP.NET Core 10 with MongoDB. Build multi-store shops and multi-vendor marketplaces with B2B/B2C, REST API, plugins, Vue 3 and Docker.

Minor changes - similarproduct component

KrzysztofPajak16ac53bf96ed
diff --git a/src/Web/Grand.Web/Components/SimilarProducts.cs b/src/Web/Grand.Web/Components/SimilarProducts.cs
index 6c1685550..65dabe90b 100644
--- a/src/Web/Grand.Web/Components/SimilarProducts.cs
+++ b/src/Web/Grand.Web/Components/SimilarProducts.cs
@@ -36,6 +36,8 @@ namespace Grand.Web.Components
public async Task<IViewComponentResult> InvokeAsync(string productId, int? productThumbPictureSize)
{
var productIds = (await _productService.GetProductById(productId)).SimilarProducts.OrderBy(x => x.DisplayOrder).Select(x => x.ProductId2).ToArray();
+ if (!productIds.Any())
+ return Content("");
var products = await _productService.GetProductsByIds(productIds);