From a2e5af58dc221e7ff89210e671c55303dc8507ac Mon Sep 17 00:00:00 2001 From: Krzysztof Pajak Date: Wed, 2 Jun 2021 09:03:42 +0200 Subject: [PATCH 1/4] Typo fix --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1456657a3..a859143df 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ This repository contains a legacy version of GrandNode. -Urgent info: We do not currently maintain the legacy version — we provide limited support for bug fixing until the end of 2022 only. All our resources are focused on GrandNode v2 development. +Urgent info: We do not currently maintain the legacy version — we provide limited support for bug fixing until the end of 2022 only. All our resources are focused on GrandNode 2.0 development. GrandNode v2 is our own open-source e-commerce platform based on .NET Core 5.0 and MongoDB. Written from the scratch. From e52798f65182150e58c1af70d6fd0dd44d42c19f Mon Sep 17 00:00:00 2001 From: KrzysztofPajak Date: Thu, 15 Jul 2021 08:51:07 +0200 Subject: [PATCH 2/4] Set version 4.9.1-develop --- Grand.Core/GrandVersion.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Grand.Core/GrandVersion.cs b/Grand.Core/GrandVersion.cs index bb7abc93f..26a224ff4 100644 --- a/Grand.Core/GrandVersion.cs +++ b/Grand.Core/GrandVersion.cs @@ -16,7 +16,7 @@ public static class GrandVersion /// /// Gets the patch version /// - public const string PatchVersion = "0-develop"; + public const string PatchVersion = "1-develop"; /// /// Gets the full version From 077f900f666864ebd996d3df5f5e19ac141b019c Mon Sep 17 00:00:00 2001 From: KrzysztofPajak Date: Thu, 15 Jul 2021 09:15:22 +0200 Subject: [PATCH 3/4] Fix - upgrade to version 4.90 - the orders collection - update the field OwnerId --- Grand.Services/Installation/UpgradeService.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Grand.Services/Installation/UpgradeService.cs b/Grand.Services/Installation/UpgradeService.cs index e59327196..e55d50d2f 100644 --- a/Grand.Services/Installation/UpgradeService.cs +++ b/Grand.Services/Installation/UpgradeService.cs @@ -1115,9 +1115,16 @@ await _activityLogTypeRepository.InsertAsync(new ActivityLogType() { #region Upgrade orders var orderRepository = _serviceProvider.GetRequiredService>(); - var query = orderRepository.Table.Where(x => x.CurrencyRate != 1 && (x.Rate != 1 || x.Rate != 0)).ToList(); + + //update store owner + await orderRepository.Table.ForEachAsync(async (o) => + { + o.OwnerId = o.CustomerId; + await orderRepository.UpdateAsync(o); + }); //upgrade Currency value + var query = orderRepository.Table.Where(x => x.CurrencyRate != 1 && (x.Rate != 1 || x.Rate != 0)).ToList(); foreach (var order in query) { var rate = order.CurrencyRate; From c209758031e88d0279a023a7237b1f68ebd9f4dc Mon Sep 17 00:00:00 2001 From: KrzysztofPajak Date: Thu, 15 Jul 2021 09:24:56 +0200 Subject: [PATCH 4/4] Allow to use recommended products per store --- Grand.Core/Caching/Constants/ProductCacheKey.cs | 3 ++- .../Handlers/Catalog/GetRecommendedProductsQueryHandler.cs | 2 +- .../Queries/Models/Catalog/GetRecommendedProductsQuery.cs | 1 + Grand.Web/Components/RecommendedProducts.cs | 5 ++++- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Grand.Core/Caching/Constants/ProductCacheKey.cs b/Grand.Core/Caching/Constants/ProductCacheKey.cs index 57e42c98b..d61d4fa70 100644 --- a/Grand.Core/Caching/Constants/ProductCacheKey.cs +++ b/Grand.Core/Caching/Constants/ProductCacheKey.cs @@ -20,8 +20,9 @@ public static partial class CacheKey /// /// /// {0} : customer ID + /// {1} : store ID /// - public static string PRODUCTS_CUSTOMER_ROLE => "Grand.product.cr-{0}"; + public static string PRODUCTS_CUSTOMER_ROLE => "Grand.product.cr-{0}-{1}"; /// /// Key for caching diff --git a/Grand.Services/Queries/Handlers/Catalog/GetRecommendedProductsQueryHandler.cs b/Grand.Services/Queries/Handlers/Catalog/GetRecommendedProductsQueryHandler.cs index 3dc14e6f9..7cfd01d80 100644 --- a/Grand.Services/Queries/Handlers/Catalog/GetRecommendedProductsQueryHandler.cs +++ b/Grand.Services/Queries/Handlers/Catalog/GetRecommendedProductsQueryHandler.cs @@ -34,7 +34,7 @@ public GetRecommendedProductsQueryHandler( public async Task> Handle(GetRecommendedProductsQuery request, CancellationToken cancellationToken) { - return await _cacheBase.GetAsync(string.Format(CacheKey.PRODUCTS_CUSTOMER_ROLE, string.Join(",", request.CustomerRoleIds)), async () => + return await _cacheBase.GetAsync(string.Format(CacheKey.PRODUCTS_CUSTOMER_ROLE, string.Join(",", request.CustomerRoleIds), request.StoreId), async () => { var query = from cr in _customerRoleProductRepository.Table where request.CustomerRoleIds.Contains(cr.CustomerRoleId) diff --git a/Grand.Services/Queries/Models/Catalog/GetRecommendedProductsQuery.cs b/Grand.Services/Queries/Models/Catalog/GetRecommendedProductsQuery.cs index bf1c3c835..d33335631 100644 --- a/Grand.Services/Queries/Models/Catalog/GetRecommendedProductsQuery.cs +++ b/Grand.Services/Queries/Models/Catalog/GetRecommendedProductsQuery.cs @@ -7,5 +7,6 @@ namespace Grand.Services.Queries.Models.Catalog public class GetRecommendedProductsQuery : IRequest> { public string[] CustomerRoleIds { get; set; } + public string StoreId { get; set; } } } diff --git a/Grand.Web/Components/RecommendedProducts.cs b/Grand.Web/Components/RecommendedProducts.cs index 1a2fcd11c..3c6f1120a 100644 --- a/Grand.Web/Components/RecommendedProducts.cs +++ b/Grand.Web/Components/RecommendedProducts.cs @@ -17,6 +17,7 @@ public class RecommendedProductsViewComponent : BaseViewComponent #region Fields private readonly IWorkContext _workContext; + private readonly IStoreContext _storeContext; private readonly IMediator _mediator; private readonly CatalogSettings _catalogSettings; @@ -26,10 +27,12 @@ public class RecommendedProductsViewComponent : BaseViewComponent public RecommendedProductsViewComponent( IWorkContext workContext, + IStoreContext storeContext, IMediator mediator, CatalogSettings catalogSettings) { _workContext = workContext; + _storeContext = storeContext; _mediator = mediator; _catalogSettings = catalogSettings; } @@ -43,7 +46,7 @@ public async Task InvokeAsync(int? productThumbPictureSize if (!_catalogSettings.RecommendedProductsEnabled) return Content(""); - var products = await _mediator.Send(new GetRecommendedProductsQuery() { CustomerRoleIds = _workContext.CurrentCustomer.GetCustomerRoleIds() }); + var products = await _mediator.Send(new GetRecommendedProductsQuery() { CustomerRoleIds = _workContext.CurrentCustomer.GetCustomerRoleIds(), StoreId = _storeContext.CurrentStore.Id }); if (!products.Any()) return Content("");