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.
C# aspnet-corecsharpdockerdotnetecommerceecommerce-platformmongodbmulti-storemulti-vendornosqlonline-shopshoppingcart
Minor changes - similar products - component
KrzysztofPajak989e690a7bfe
diff --git a/src/Web/Grand.Web/Components/SimilarProducts.cs b/src/Web/Grand.Web/Components/SimilarProducts.csindex 63aea3721..6c1685550 100644--- a/src/Web/Grand.Web/Components/SimilarProducts.cs+++ b/src/Web/Grand.Web/Components/SimilarProducts.cs@@ -1,10 +1,7 @@using Grand.Business.Catalog.Interfaces.Products;-using Grand.Infrastructure;-using Grand.Infrastructure.Caching;using Grand.Domain.Catalog;using Grand.Web.Common.Components;using Grand.Web.Features.Models.Products;-using Grand.Web.Events.Cache;using MediatR;using Microsoft.AspNetCore.Mvc;using System.Linq;@@ -15,9 +12,7 @@ namespace Grand.Web.Componentspublic class SimilarProductsViewComponent : BaseViewComponent{#region Fields- private readonly ICacheBase _cacheBase;private readonly IProductService _productService;- private readonly IWorkContext _workContext;private readonly IMediator _mediator;private readonly CatalogSettings _catalogSettings;@@ -26,15 +21,11 @@ namespace Grand.Web.Components#region Constructorspublic SimilarProductsViewComponent(- ICacheBase cacheBase,IProductService productService,- IWorkContext workContext,IMediator mediator,CatalogSettings catalogSettings){- _cacheBase = cacheBase;_productService = productService;- _workContext = workContext;_mediator = mediator;_catalogSettings = catalogSettings;}@@ -44,17 +35,14 @@ namespace Grand.Web.Componentspublic async Task<IViewComponentResult> InvokeAsync(string productId, int? productThumbPictureSize){-- var productIds = await _cacheBase.GetAsync(string.Format(CacheKeyConst.PRODUCTS_SIMILAR_IDS_KEY, productId, _workContext.CurrentStore.Id),- async () => (await _productService.GetProductById(productId)).SimilarProducts.OrderBy(x => x.DisplayOrder).Select(x => x.ProductId2).ToArray());+ var productIds = (await _productService.GetProductById(productId)).SimilarProducts.OrderBy(x => x.DisplayOrder).Select(x => x.ProductId2).ToArray();var products = await _productService.GetProductsByIds(productIds);if (!products.Any())return Content("");- var model = await _mediator.Send(new GetProductOverview()- {+ var model = await _mediator.Send(new GetProductOverview() {PreparePictureModel = true,PreparePriceModel = true,PrepareSpecificationAttributes = _catalogSettings.ShowSpecAttributeOnCatalogPages,diff --git a/src/Web/Grand.Web/Events/Cache/CacheKeyConst.cs b/src/Web/Grand.Web/Events/Cache/CacheKeyConst.csindex 950a86f37..dd6855ea3 100644--- a/src/Web/Grand.Web/Events/Cache/CacheKeyConst.cs+++ b/src/Web/Grand.Web/Events/Cache/CacheKeyConst.cs@@ -276,15 +276,6 @@ namespace Grand.Web.Events.Cache/// </remarks>public const string PRODUCTS_RELATED_IDS_KEY = "Grand.product.id-{0}-{1}.pres.related";- /// <summary>- /// Key for "similar" product identifiers displayed on the product details page- /// </summary>- /// <remarks>- /// {0} : current product id- /// {1} : current store ID- /// </remarks>- public const string PRODUCTS_SIMILAR_IDS_KEY = "Grand.product.id-{0}-{1}.pres.similar";-/// <summary>/// Key for blog tag list model/// </summary>