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
Allow managing bestsellers manually directly on the product #5 - further improvements
KrzysztofPajakce8a65d37345
diff --git a/src/Web/Grand.Web/App_Data/Resources/DefaultLanguage.xml b/src/Web/Grand.Web/App_Data/Resources/DefaultLanguage.xmlindex c500fadfc..a891ac1fc 100644--- a/src/Web/Grand.Web/App_Data/Resources/DefaultLanguage.xml+++ b/src/Web/Grand.Web/App_Data/Resources/DefaultLanguage.xml@@ -10480,6 +10480,9 @@<Resource Name="Admin.Settings.Catalog.BestsellersFromReports"><Value>Best seller products get from report</Value></Resource>+ <Resource Name="Admin.Settings.Catalog.BestsellersFromReports.hint">+ <Value>Reports data are cached, refreshing will be after the expiration time.</Value>+ </Resource><Resource Name="Admin.Settings.Catalog.CategoryBreadcrumbEnabled"><Value>Category breadcrumb enabled</Value></Resource>diff --git a/src/Web/Grand.Web/Components/HomePageBestSellers.cs b/src/Web/Grand.Web/Components/HomePageBestSellers.csindex a38604c37..b656d8bc6 100644--- a/src/Web/Grand.Web/Components/HomePageBestSellers.cs+++ b/src/Web/Grand.Web/Components/HomePageBestSellers.cs@@ -85,7 +85,7 @@ namespace Grand.Web.Componentsvar model = await _mediator.Send(new GetProductOverview(){ProductThumbPictureSize = productThumbPictureSize,- Products = products,+ Products = products.Take(_catalogSettings.NumberOfBestsellersOnHomepage),});return View(model);diff --git a/src/Web/Grand.Web/Events/Cache/CacheKeyConst.cs b/src/Web/Grand.Web/Events/Cache/CacheKeyConst.csindex cdeb1998a..68c7617e5 100644--- a/src/Web/Grand.Web/Events/Cache/CacheKeyConst.cs+++ b/src/Web/Grand.Web/Events/Cache/CacheKeyConst.cs@@ -238,13 +238,12 @@ namespace Grand.Web.Events.Cachepublic const string PRODUCT_COLLECTIONS_MODEL_KEY = "Grand.product.id-{0}-{1}-{2}-{3}.collections";/// <summary>- /// Key for bestsellers identifiers displayed on the home page+ /// Key for bestsellers identifiers displayed on the home page - best seller/// </summary>/// <remarks>/// {0} : current store ID/// </remarks>public const string HOMEPAGE_BESTSELLERS_IDS_KEY = "Grand.pres.bestsellers.homepage-{0}";- public const string HOMEPAGE_BESTSELLERS_IDS_PATTERN_KEY = "Grand.pres.bestsellers.homepage";/// <summary>diff --git a/src/Web/Grand.Web/Events/Cache/OrderNotificatioHandler.cs b/src/Web/Grand.Web/Events/Cache/OrderNotificatioHandler.csdeleted file mode 100644index ba3af8081..000000000--- a/src/Web/Grand.Web/Events/Cache/OrderNotificatioHandler.cs+++ /dev/null@@ -1,36 +0,0 @@-using Grand.Infrastructure.Caching;-using Grand.Domain.Orders;-using Grand.Infrastructure.Events;-using MediatR;-using System.Threading;-using System.Threading.Tasks;--namespace Grand.Web.Events.Cache-{- public class OrderNotificatioHandler :- INotificationHandler<EntityInserted<Order>>,- INotificationHandler<EntityUpdated<Order>>,- INotificationHandler<EntityDeleted<Order>>- {-- private readonly ICacheBase _cacheBase;-- public OrderNotificatioHandler(ICacheBase cacheBase)- {- _cacheBase = cacheBase;- }-- public async Task Handle(EntityInserted<Order> eventMessage, CancellationToken cancellationToken)- {- await _cacheBase.RemoveByPrefix(CacheKeyConst.HOMEPAGE_BESTSELLERS_IDS_PATTERN_KEY);- }- public async Task Handle(EntityUpdated<Order> eventMessage, CancellationToken cancellationToken)- {- await _cacheBase.RemoveByPrefix(CacheKeyConst.HOMEPAGE_BESTSELLERS_IDS_PATTERN_KEY);- }- public async Task Handle(EntityDeleted<Order> eventMessage, CancellationToken cancellationToken)- {- await _cacheBase.RemoveByPrefix(CacheKeyConst.HOMEPAGE_BESTSELLERS_IDS_PATTERN_KEY);- }- }-}\ No newline at end of filediff --git a/src/Web/Grand.Web/Events/Cache/ProductNotificatioHandler.cs b/src/Web/Grand.Web/Events/Cache/ProductNotificatioHandler.csindex ad2d3a445..5eb6d5e49 100644--- a/src/Web/Grand.Web/Events/Cache/ProductNotificatioHandler.cs+++ b/src/Web/Grand.Web/Events/Cache/ProductNotificatioHandler.cs@@ -20,13 +20,11 @@ namespace Grand.Web.Events.Cachepublic async Task Handle(EntityUpdated<Product> eventMessage, CancellationToken cancellationToken){- await _cacheBase.RemoveByPrefix(CacheKeyConst.HOMEPAGE_BESTSELLERS_IDS_PATTERN_KEY);await _cacheBase.RemoveByPrefix(string.Format(CacheKeyConst.PRODUCTS_SIMILAR_IDS_PATTERN_KEY, eventMessage.Entity.Id));await _cacheBase.RemoveAsync(string.Format(CacheKeyConst.PRODUCTS_RELATED_IDS_PATTERN_KEY, eventMessage.Entity.Id));}public async Task Handle(EntityDeleted<Product> eventMessage, CancellationToken cancellationToken){- await _cacheBase.RemoveByPrefix(CacheKeyConst.HOMEPAGE_BESTSELLERS_IDS_PATTERN_KEY);await _cacheBase.RemoveByPrefix(string.Format(CacheKeyConst.PRODUCTS_SIMILAR_IDS_PATTERN_KEY, eventMessage.Entity.Id));await _cacheBase.RemoveAsync(string.Format(CacheKeyConst.PRODUCTS_RELATED_IDS_PATTERN_KEY, eventMessage.Entity.Id));}