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
fix(catalog): make the store scope explicit on the category, brand and collection lists (#767)
Krzysztof Pajak2046aaae4e95
diff --git a/src/Business/Grand.Business.Catalog/Services/Brands/BrandService.cs b/src/Business/Grand.Business.Catalog/Services/Brands/BrandService.csindex 465b32556..7e12b8a4d 100644--- a/src/Business/Grand.Business.Catalog/Services/Brands/BrandService.cs+++ b/src/Business/Grand.Business.Catalog/Services/Brands/BrandService.cs@@ -57,8 +57,8 @@ public class BrandService : IBrandService/// <param name="pageSize">Page size</param>/// <param name="showHidden">A value that indicates if it should shows hidden records</param>/// <returns>Brands</returns>- public virtual async Task<IPagedList<Brand>> GetAllBrands(string brandName = "",- string storeId = "",+ public virtual async Task<IPagedList<Brand>> GetAllBrands(string brandName,+ string storeId,int pageIndex = 0,int pageSize = int.MaxValue,bool showHidden = false)diff --git a/src/Business/Grand.Business.Catalog/Services/Categories/CategoryService.cs b/src/Business/Grand.Business.Catalog/Services/Categories/CategoryService.csindex 46cee17da..906ed4e53 100644--- a/src/Business/Grand.Business.Catalog/Services/Categories/CategoryService.cs+++ b/src/Business/Grand.Business.Catalog/Services/Categories/CategoryService.cs@@ -74,8 +74,8 @@ public class CategoryService : ICategoryService/// <param name="pageSize">Page size</param>/// <param name="showHidden">A value that indicates if it should shows hidden records</param>/// <returns>Categories</returns>- public virtual async Task<IPagedList<Category>> GetAllCategories(string parentId = null, string categoryName = "",- string storeId = "",+ public virtual async Task<IPagedList<Category>> GetAllCategories(string parentId, string categoryName,+ string storeId,int pageIndex = 0, int pageSize = int.MaxValue, bool showHidden = false){var query = from c in _categoryRepository.Tablediff --git a/src/Business/Grand.Business.Catalog/Services/Collections/CollectionService.cs b/src/Business/Grand.Business.Catalog/Services/Collections/CollectionService.csindex db6a655ee..0175e0f78 100644--- a/src/Business/Grand.Business.Catalog/Services/Collections/CollectionService.cs+++ b/src/Business/Grand.Business.Catalog/Services/Collections/CollectionService.cs@@ -61,8 +61,8 @@ public class CollectionService : ICollectionService/// <param name="pageSize">Page size</param>/// <param name="showHidden">A value that indicates if it should shows hidden records</param>/// <returns>Collections</returns>- public virtual async Task<IPagedList<Collection>> GetAllCollections(string collectionName = "",- string storeId = "",+ public virtual async Task<IPagedList<Collection>> GetAllCollections(string collectionName,+ string storeId,int pageIndex = 0,int pageSize = int.MaxValue,bool showHidden = false)diff --git a/src/Business/Grand.Business.Core/Interfaces/Catalog/Brands/IBrandService.cs b/src/Business/Grand.Business.Core/Interfaces/Catalog/Brands/IBrandService.csindex bd2e353ce..11e09608f 100644--- a/src/Business/Grand.Business.Core/Interfaces/Catalog/Brands/IBrandService.cs+++ b/src/Business/Grand.Business.Core/Interfaces/Catalog/Brands/IBrandService.cs@@ -17,8 +17,8 @@ public interface IBrandService/// <param name="pageSize">Page size</param>/// <param name="showHidden">A value that indicates if it should shows hidden records</param>/// <returns>Brands</returns>- Task<IPagedList<Brand>> GetAllBrands(string brandName = "",- string storeId = "",+ Task<IPagedList<Brand>> GetAllBrands(string brandName,+ string storeId,int pageIndex = 0,int pageSize = int.MaxValue,bool showHidden = false);diff --git a/src/Business/Grand.Business.Core/Interfaces/Catalog/Categories/ICategoryService.cs b/src/Business/Grand.Business.Core/Interfaces/Catalog/Categories/ICategoryService.csindex a6ce034fc..5015edb1a 100644--- a/src/Business/Grand.Business.Core/Interfaces/Catalog/Categories/ICategoryService.cs+++ b/src/Business/Grand.Business.Core/Interfaces/Catalog/Categories/ICategoryService.cs@@ -15,7 +15,7 @@ public interface ICategoryService/// <param name="pageSize">Page size</param>/// <param name="showHidden">A value that indicates if it should shows hidden records</param>/// <returns>Categories</returns>- Task<IPagedList<Category>> GetAllCategories(string parentId = null, string categoryName = "", string storeId = "",+ Task<IPagedList<Category>> GetAllCategories(string parentId, string categoryName, string storeId,int pageIndex = 0, int pageSize = int.MaxValue, bool showHidden = false);/// <summary>diff --git a/src/Business/Grand.Business.Core/Interfaces/Catalog/Collections/ICollectionService.cs b/src/Business/Grand.Business.Core/Interfaces/Catalog/Collections/ICollectionService.csindex ecae8e334..fa1c18d63 100644--- a/src/Business/Grand.Business.Core/Interfaces/Catalog/Collections/ICollectionService.cs+++ b/src/Business/Grand.Business.Core/Interfaces/Catalog/Collections/ICollectionService.cs@@ -17,8 +17,8 @@ public interface ICollectionService/// <param name="pageSize">Page size</param>/// <param name="showHidden">A value that indicates if it should shows hidden records</param>/// <returns>Collections</returns>- Task<IPagedList<Collection>> GetAllCollections(string collectionName = "",- string storeId = "",+ Task<IPagedList<Collection>> GetAllCollections(string collectionName,+ string storeId,int pageIndex = 0,int pageSize = int.MaxValue,bool showHidden = false);diff --git a/src/Business/Grand.Business.Messages/Commands/Handlers/Common/GetSitemapXMLCommandHandler.cs b/src/Business/Grand.Business.Messages/Commands/Handlers/Common/GetSitemapXMLCommandHandler.csindex 4b89039f8..ce42c9ecd 100644--- a/src/Business/Grand.Business.Messages/Commands/Handlers/Common/GetSitemapXMLCommandHandler.cs+++ b/src/Business/Grand.Business.Messages/Commands/Handlers/Common/GetSitemapXMLCommandHandler.cs@@ -231,7 +231,7 @@ public class GetSitemapXmlCommandHandler : IRequestHandler<GetSitemapXmlCommand,private async Task<IEnumerable<SitemapUrl>> GetBrandUrls(Language language, Store store){- var brands = await _brandService.GetAllBrands(storeId: store.Id);+ var brands = await _brandService.GetAllBrands(brandName: "", storeId: store.Id);var brandUrls = new List<SitemapUrl>();var storeLocation = GetStoreLocation();foreach (var brand in brands)diff --git a/src/Tests/Grand.Business.Catalog.Tests/Services/Brands/BrandServiceTests.cs b/src/Tests/Grand.Business.Catalog.Tests/Services/Brands/BrandServiceTests.csindex e49faab2e..a648d49e9 100644--- a/src/Tests/Grand.Business.Catalog.Tests/Services/Brands/BrandServiceTests.cs+++ b/src/Tests/Grand.Business.Catalog.Tests/Services/Brands/BrandServiceTests.cs@@ -47,7 +47,7 @@ public class BrandServiceTestsawait _brandService.InsertBrand(new Brand { Published = true });//Act- var brand = await _brandService.GetAllBrands();+ var brand = await _brandService.GetAllBrands(brandName: "", storeId: "");//AssertAssert.HasCount(3, brand);diff --git a/src/Tests/Grand.Business.Catalog.Tests/Services/Categories/CategoryServiceDbTests.cs b/src/Tests/Grand.Business.Catalog.Tests/Services/Categories/CategoryServiceDbTests.csindex bf8f0484a..03583a402 100644--- a/src/Tests/Grand.Business.Catalog.Tests/Services/Categories/CategoryServiceDbTests.cs+++ b/src/Tests/Grand.Business.Catalog.Tests/Services/Categories/CategoryServiceDbTests.cs@@ -106,7 +106,7 @@ public class CategoryServiceDbTests{var allCategory = GetMockCategoryList();allCategory.ToList().ForEach(x => _categoryService.InsertCategory(x).GetAwaiter().GetResult());- var result = await _categoryService.GetAllCategories();+ var result = await _categoryService.GetAllCategories(parentId: null, categoryName: "", storeId: "");Assert.HasCount(5, result);}diff --git a/src/Tests/Grand.Business.Common.Tests/Services/Security/AclServiceTest.cs b/src/Tests/Grand.Business.Common.Tests/Services/Security/AclServiceTest.csindex 6d48b43ec..b59b1ae94 100644--- a/src/Tests/Grand.Business.Common.Tests/Services/Security/AclServiceTest.cs+++ b/src/Tests/Grand.Business.Common.Tests/Services/Security/AclServiceTest.cs@@ -42,4 +42,22 @@ public class AclServiceTest_accessControlConfig.IgnoreStoreLimitations = true;Assert.IsTrue(_aclService.Authorize(product, "id"));}++ /// <summary>+ /// Pins the fail-open: an empty store grants access even to an entity that is limited to other+ /// stores. Callers therefore carry the whole burden of supplying the store - which is why the+ /// list services no longer default that argument away.+ /// </summary>+ [TestMethod]+ public void Authorize_WithoutAStore_GrantsAccessToAnEntityLimitedToOtherStores()+ {+ var product = new Product {+ LimitedToStores = true,+ Stores = { "another-store" }+ };++ Assert.IsFalse(_aclService.Authorize(product, "this-store"), "the store is not among the entity's stores");+ Assert.IsTrue(_aclService.Authorize(product, ""), "fail-open: no store means no check");+ Assert.IsTrue(_aclService.Authorize(product, (string)null), "fail-open: no store means no check");+ }}\ No newline at end of filediff --git a/src/Tests/Grand.Web.Admin.Tests/Extensions/AclMappingExtensionTests.cs b/src/Tests/Grand.Web.Admin.Tests/Extensions/AclMappingExtensionTests.csnew file mode 100644index 000000000..8f8d4c83f--- /dev/null+++ b/src/Tests/Grand.Web.Admin.Tests/Extensions/AclMappingExtensionTests.cs@@ -0,0 +1,58 @@+using Grand.Domain.Catalog;+using Grand.Web.AdminShared.Extensions;+using Microsoft.VisualStudio.TestTools.UnitTesting;+using Assert = Microsoft.VisualStudio.TestTools.UnitTesting.Assert;++namespace Grand.Web.Admin.Tests.Extensions;++[TestClass]+public class AclMappingExtensionTests+{+ /// <summary>+ /// Pins the fail-open: an empty store grants access even to an entity limited to another store.+ /// </summary>+ [TestMethod]+ public void AccessToEntityByStore_WithoutAStore_GrantsAccessToAnEntityLimitedToOtherStores()+ {+ var product = new Product {+ LimitedToStores = true,+ Stores = { "another-store" }+ };++ Assert.IsFalse(product.AccessToEntityByStore("this-store"));+ Assert.IsTrue(product.AccessToEntityByStore(""), "fail-open: no store means no check");+ }++ /// <summary>+ /// This check is stricter than AclService.Authorize on the same-sounding question: an entity+ /// shared with a second store is refused here, while AclService grants it. Anyone reaching for+ /// "does this store own the entity" has to pick deliberately between the two.+ /// </summary>+ [TestMethod]+ public void AccessToEntityByStore_RefusesAnEntitySharedWithASecondStore()+ {+ var product = new Product {+ LimitedToStores = true,+ Stores = { "this-store", "another-store" }+ };++ Assert.IsFalse(product.AccessToEntityByStore("this-store"));+ }++ [TestMethod]+ public void AccessToEntityByStore_AcceptsAnEntityOwnedByThatStoreAlone()+ {+ var product = new Product {+ LimitedToStores = true,+ Stores = { "this-store" }+ };++ Assert.IsTrue(product.AccessToEntityByStore("this-store"));+ }++ [TestMethod]+ public void AccessToEntityByStore_RefusesAMissingEntity()+ {+ Assert.IsFalse(((Product)null).AccessToEntityByStore("this-store"));+ }+}diff --git a/src/Web/Grand.Web.Admin/Controllers/BrandController.cs b/src/Web/Grand.Web.Admin/Controllers/BrandController.csindex e0a1ad7eb..fb242820f 100644--- a/src/Web/Grand.Web.Admin/Controllers/BrandController.cs+++ b/src/Web/Grand.Web.Admin/Controllers/BrandController.cs@@ -273,7 +273,7 @@ public class BrandController : BaseAdminController{try{- var bytes = await exportManager.Export(await _brandService.GetAllBrands(showHidden: true));+ var bytes = await exportManager.Export(await _brandService.GetAllBrands(brandName: "", storeId: "", showHidden: true));return File(bytes, "text/xls", "brands.xlsx");}catch (Exception exc)diff --git a/src/Web/Grand.Web.Admin/Controllers/CategoryController.cs b/src/Web/Grand.Web.Admin/Controllers/CategoryController.csindex 61cecf604..9b962438d 100644--- a/src/Web/Grand.Web.Admin/Controllers/CategoryController.cs+++ b/src/Web/Grand.Web.Admin/Controllers/CategoryController.cs@@ -230,7 +230,7 @@ public class CategoryController : BaseAdminController{try{- var bytes = await exportManager.Export(await _categoryService.GetAllCategories(showHidden: true));+ var bytes = await exportManager.Export(await _categoryService.GetAllCategories(parentId: null, categoryName: "", storeId: "", showHidden: true));return File(bytes, "text/xls", "categories.xlsx");}catch (Exception exc)diff --git a/src/Web/Grand.Web.Admin/Controllers/CollectionController.cs b/src/Web/Grand.Web.Admin/Controllers/CollectionController.csindex d871db579..cd385b8ce 100644--- a/src/Web/Grand.Web.Admin/Controllers/CollectionController.cs+++ b/src/Web/Grand.Web.Admin/Controllers/CollectionController.cs@@ -268,7 +268,7 @@ public class CollectionController : BaseAdminController{try{- var bytes = await exportManager.Export(await _collectionService.GetAllCollections(showHidden: true));+ var bytes = await exportManager.Export(await _collectionService.GetAllCollections(collectionName: "", storeId: "", showHidden: true));return File(bytes, "text/xls", "collections.xlsx");}catch (Exception exc)diff --git a/src/Web/Grand.Web.Admin/Controllers/DiscountController.cs b/src/Web/Grand.Web.Admin/Controllers/DiscountController.csindex d74c11b91..fa7c03553 100644--- a/src/Web/Grand.Web.Admin/Controllers/DiscountController.cs+++ b/src/Web/Grand.Web.Admin/Controllers/DiscountController.cs@@ -513,7 +513,7 @@ public class DiscountController : BaseAdminControllerpublic async Task<IActionResult> CategoryAddPopupList(DataSourceRequest command,DiscountModel.AddCategoryToDiscountModel model, [FromServices] ICategoryService categoryService){- var categories = await categoryService.GetAllCategories(categoryName: model.SearchCategoryName,+ var categories = await categoryService.GetAllCategories(parentId: null, categoryName: model.SearchCategoryName, storeId: "",pageIndex: command.Page - 1, pageSize: command.PageSize, showHidden: true);var items = new List<CategoryModel>();foreach (var item in categories)diff --git a/src/Web/Grand.Web.Admin/Controllers/SearchController.cs b/src/Web/Grand.Web.Admin/Controllers/SearchController.csindex 332e80e4b..4c649a990 100644--- a/src/Web/Grand.Web.Admin/Controllers/SearchController.cs+++ b/src/Web/Grand.Web.Admin/Controllers/SearchController.cs@@ -90,7 +90,7 @@ public class SearchController : BaseAdminControllerif (result.Count < _adminSearchSettings.MaxSearchResultsCount && _adminSearchSettings.SearchInCategories){- var categories = await _categoryService.GetAllCategories(categoryName: searchTerm,+ var categories = await _categoryService.GetAllCategories(parentId: null, categoryName: searchTerm, storeId: "",pageSize: _adminSearchSettings.MaxSearchResultsCount - result.Count, showHidden:await _groupService.IsAdmin(_contextAccessor.WorkContext.CurrentCustomer));foreach (var category in categories)@@ -104,7 +104,7 @@ public class SearchController : BaseAdminControllerif (result.Count < _adminSearchSettings.MaxSearchResultsCount && _adminSearchSettings.SearchInCollections){- var collections = await _collectionService.GetAllCollections(searchTerm,+ var collections = await _collectionService.GetAllCollections(searchTerm, storeId: "",pageSize: _adminSearchSettings.MaxSearchResultsCount - result.Count, showHidden: true);foreach (var collection in collections)result.Add(new Tuple<object, int>(new@@ -300,6 +300,7 @@ public class SearchController : BaseAdminController{var brands = await _brandService.GetAllBrands(model.GetNameFilterValue(),+ storeId: "",pageSize: _adminSearchSettings.BrandSizeLimit);var gridModel = await DataSourceResultHelper.GetSearchResult(brandId, brands, brand => Task.FromResult(brand.Name));diff --git a/src/Web/Grand.Web.AdminShared/Services/CategoryViewModelService.cs b/src/Web/Grand.Web.AdminShared/Services/CategoryViewModelService.csindex 9ff867537..d9f60512c 100644--- a/src/Web/Grand.Web.AdminShared/Services/CategoryViewModelService.cs+++ b/src/Web/Grand.Web.AdminShared/Services/CategoryViewModelService.cs@@ -76,6 +76,7 @@ public class CategoryViewModelService : ICategoryViewModelServiceCategoryListModel model, int pageIndex, int pageSize){var categories = await _categoryService.GetAllCategories(+ parentId: null,categoryName: model.SearchCategoryName,storeId: model.SearchStoreId,pageSize: pageSize,diff --git a/src/Web/Grand.Web.AdminShared/Services/CollectionViewModelService.cs b/src/Web/Grand.Web.AdminShared/Services/CollectionViewModelService.csindex 530b5d63d..c116f72c9 100644--- a/src/Web/Grand.Web.AdminShared/Services/CollectionViewModelService.cs+++ b/src/Web/Grand.Web.AdminShared/Services/CollectionViewModelService.cs@@ -181,7 +181,8 @@ public class CollectionViewModelService : ICollectionViewModelService//collectionsmodel.AvailableCollections.Add(new SelectListItem{ Text = _translationService.GetResource("Admin.Common.All"), Value = " " });- foreach (var m in await _collectionService.GetAllCollections(showHidden: true))+ foreach (var m in await _collectionService.GetAllCollections(collectionName: "", storeId: "",+ showHidden: true))model.AvailableCollections.Add(new SelectListItem { Text = m.Name, Value = m.Id });//storesdiff --git a/src/Web/Grand.Web.Store/Controllers/DiscountController.cs b/src/Web/Grand.Web.Store/Controllers/DiscountController.csindex eddbc4cd2..c46479ffc 100644--- a/src/Web/Grand.Web.Store/Controllers/DiscountController.cs+++ b/src/Web/Grand.Web.Store/Controllers/DiscountController.cs@@ -1,4 +1,4 @@-using Grand.Business.Core.Interfaces.Catalog.Brands;+using Grand.Business.Core.Interfaces.Catalog.Brands;using Grand.Business.Core.Interfaces.Catalog.Categories;using Grand.Business.Core.Interfaces.Catalog.Collections;using Grand.Business.Core.Interfaces.Catalog.Discounts;@@ -515,7 +515,7 @@ public class DiscountController : BaseStoreControllerpublic async Task<IActionResult> CategoryAddPopupList(DataSourceRequest command,DiscountModel.AddCategoryToDiscountModel model, [FromServices] ICategoryService categoryService){- var categories = await categoryService.GetAllCategories(categoryName: model.SearchCategoryName,+ var categories = await categoryService.GetAllCategories(parentId: null, categoryName: model.SearchCategoryName,storeId: CurrentStoreId, pageIndex: command.Page - 1, pageSize: command.PageSize, showHidden: true);var items = new List<CategoryModel>();foreach (var item in categories)diff --git a/src/Web/Grand.Web/Features/Handlers/Catalog/GetBrandAllHandler.cs b/src/Web/Grand.Web/Features/Handlers/Catalog/GetBrandAllHandler.csindex f99800fd1..1fbe7fdc3 100644--- a/src/Web/Grand.Web/Features/Handlers/Catalog/GetBrandAllHandler.cs+++ b/src/Web/Grand.Web/Features/Handlers/Catalog/GetBrandAllHandler.cs@@ -47,7 +47,7 @@ public class GetBrandAllHandler : IRequestHandler<GetBrandAll, BrandListModel>request.Command.PageSize = _catalogSettings.MaxCatalogPageSize;var model = new List<BrandModel>();- var brands = await _brandService.GetAllBrands(storeId: request.Store.Id,+ var brands = await _brandService.GetAllBrands(brandName: "", storeId: request.Store.Id,pageIndex: request.Command.PageNumber - 1,pageSize: request.Command.PageSize);diff --git a/src/Web/Grand.Web/Features/Handlers/Catalog/GetCategoryAllHandler.cs b/src/Web/Grand.Web/Features/Handlers/Catalog/GetCategoryAllHandler.csindex 125b5a10f..829f44813 100644--- a/src/Web/Grand.Web/Features/Handlers/Catalog/GetCategoryAllHandler.cs+++ b/src/Web/Grand.Web/Features/Handlers/Catalog/GetCategoryAllHandler.cs@@ -48,7 +48,7 @@ public class GetCategoryAllHandler : IRequestHandler<GetCategoryAll, CategoryLisrequest.Command.PageSize = _catalogSettings.MaxCatalogPageSize;var model = new List<CategoryModel>();- var categories = await _categoryService.GetAllCategories(storeId: request.Store.Id,+ var categories = await _categoryService.GetAllCategories(parentId: null, categoryName: "", storeId: request.Store.Id,pageIndex: request.Command.PageNumber - 1,pageSize: request.Command.PageSize);diff --git a/src/Web/Grand.Web/Features/Handlers/Catalog/GetCategorySimpleHandler.cs b/src/Web/Grand.Web/Features/Handlers/Catalog/GetCategorySimpleHandler.csindex c20d4560b..dc5e72f90 100644--- a/src/Web/Grand.Web/Features/Handlers/Catalog/GetCategorySimpleHandler.cs+++ b/src/Web/Grand.Web/Features/Handlers/Catalog/GetCategorySimpleHandler.cs@@ -65,7 +65,7 @@ public class GetCategorySimpleHandler : IRequestHandler<GetCategorySimple, IListasync Task PrepareCategories(string categoryId){- var parentCategories = await _categoryService.GetAllCategories(categoryId, storeId: request.Store.Id);+ var parentCategories = await _categoryService.GetAllCategories(categoryId, categoryName: "", storeId: request.Store.Id);if (parentCategories.Any()){categories.AddRange(parentCategories);@@ -79,7 +79,7 @@ public class GetCategorySimpleHandler : IRequestHandler<GetCategorySimple, IListif (currentCategory != null){var currentCategories =- await _categoryService.GetAllCategories(currentCategory.Id, storeId: request.Store.Id);+ await _categoryService.GetAllCategories(currentCategory.Id, categoryName: "", storeId: request.Store.Id);categories.AddRange(currentCategories);await PrepareCategories(currentCategory.ParentCategoryId);}diff --git a/src/Web/Grand.Web/Features/Handlers/Catalog/GetCollectionAllHandler.cs b/src/Web/Grand.Web/Features/Handlers/Catalog/GetCollectionAllHandler.csindex 75bdf8e9b..ba4c3912d 100644--- a/src/Web/Grand.Web/Features/Handlers/Catalog/GetCollectionAllHandler.cs+++ b/src/Web/Grand.Web/Features/Handlers/Catalog/GetCollectionAllHandler.cs@@ -48,7 +48,7 @@ public class GetCollectionAllHandler : IRequestHandler<GetCollectionAll, Collectrequest.Command.PageSize = _catalogSettings.MaxCatalogPageSize;var model = new List<CollectionModel>();- var collections = await _collectionService.GetAllCollections(storeId: request.Store.Id,+ var collections = await _collectionService.GetAllCollections(collectionName: "", storeId: request.Store.Id,pageIndex: request.Command.PageNumber - 1,pageSize: request.Command.PageSize);diff --git a/src/Web/Grand.Web/Features/Handlers/Catalog/GetCollectionNavigationHandler.cs b/src/Web/Grand.Web/Features/Handlers/Catalog/GetCollectionNavigationHandler.csindex df5254db4..8aeb58593 100644--- a/src/Web/Grand.Web/Features/Handlers/Catalog/GetCollectionNavigationHandler.cs+++ b/src/Web/Grand.Web/Features/Handlers/Catalog/GetCollectionNavigationHandler.cs@@ -35,7 +35,7 @@ public class GetCollectionNavigationHandler : IRequestHandler<GetCollectionNavig{var currentCollection = await _collectionService.GetCollectionById(request.CurrentCollectionId);var collections =- await _collectionService.GetAllCollections(pageSize: _catalogSettings.CollectionsBlockItemsToDisplay,+ await _collectionService.GetAllCollections(collectionName: "", pageSize: _catalogSettings.CollectionsBlockItemsToDisplay,storeId: request.Store.Id);var model = new CollectionNavigationModel {TotalCollections = collections.TotalCountdiff --git a/src/Web/Grand.Web/Features/Handlers/Catalog/GetHomepageBrandsHandler.cs b/src/Web/Grand.Web/Features/Handlers/Catalog/GetHomepageBrandsHandler.csindex 81fb2b4a7..7d253d9d9 100644--- a/src/Web/Grand.Web/Features/Handlers/Catalog/GetHomepageBrandsHandler.cs+++ b/src/Web/Grand.Web/Features/Handlers/Catalog/GetHomepageBrandsHandler.cs@@ -41,7 +41,7 @@ public class GetHomepageBrandsHandler : IRequestHandler<GetHomepageBrands, IListvar model = await _cacheBase.GetAsync(brandsCacheKey, async () =>{var modelBrands = new List<BrandModel>();- var allBrands = await _brandService.GetAllBrands(storeId: request.Store.Id);+ var allBrands = await _brandService.GetAllBrands(brandName: "", storeId: request.Store.Id);foreach (var x in allBrands.Where(x => x.ShowOnHomePage)){var brandModel = x.ToModel(request.Language);diff --git a/src/Web/Grand.Web/Features/Handlers/Catalog/GetHomepageCollectionsHandler.cs b/src/Web/Grand.Web/Features/Handlers/Catalog/GetHomepageCollectionsHandler.csindex be8e0c12c..4f5123e79 100644--- a/src/Web/Grand.Web/Features/Handlers/Catalog/GetHomepageCollectionsHandler.cs+++ b/src/Web/Grand.Web/Features/Handlers/Catalog/GetHomepageCollectionsHandler.cs@@ -43,7 +43,7 @@ public class GetHomepageCollectionsHandler : IRequestHandler<GetHomepageCollectivar model = await _cacheBase.GetAsync(collectionsCacheKey, async () =>{var modelCollect = new List<CollectionModel>();- var allcollections = await _collectionService.GetAllCollections(storeId: request.Store.Id);+ var allcollections = await _collectionService.GetAllCollections(collectionName: "", storeId: request.Store.Id);foreach (var x in allcollections.Where(x => x.ShowOnHomePage)){var _model = x.ToModel(request.Language);diff --git a/src/Web/Grand.Web/Features/Handlers/Catalog/GetMenuHandler.cs b/src/Web/Grand.Web/Features/Handlers/Catalog/GetMenuHandler.csindex 34c7ff2d3..0aaddc9a7 100644--- a/src/Web/Grand.Web/Features/Handlers/Catalog/GetMenuHandler.cs+++ b/src/Web/Grand.Web/Features/Handlers/Catalog/GetMenuHandler.cs@@ -79,7 +79,7 @@ public class GetMenuHandler : IRequestHandler<GetMenu, MenuModel>request.Language.Id, request.Store.Id);var cachedBrandModel = await _cacheBase.GetAsync(brandCacheKey, async () =>- (await _brandService.GetAllBrands(storeId: request.Store.Id))+ (await _brandService.GetAllBrands(brandName: "", storeId: request.Store.Id)).Where(x => x.IncludeInMenu).Select(t => new MenuModel.MenuBrandModel {Id = t.Id,@@ -94,7 +94,7 @@ public class GetMenuHandler : IRequestHandler<GetMenu, MenuModel>request.Language.Id, request.Store.Id);var cachedCollectionModel = await _cacheBase.GetAsync(collectionCacheKey, async () =>- (await _collectionService.GetAllCollections(storeId: request.Store.Id))+ (await _collectionService.GetAllCollections(collectionName: "", storeId: request.Store.Id)).Where(x => x.IncludeInMenu).Select(t => new MenuModel.MenuCollectionModel {Id = t.Id,diff --git a/src/Web/Grand.Web/Features/Handlers/Catalog/GetSearchHandler.cs b/src/Web/Grand.Web/Features/Handlers/Catalog/GetSearchHandler.csindex d77864c19..0c2921b6d 100644--- a/src/Web/Grand.Web/Features/Handlers/Catalog/GetSearchHandler.cs+++ b/src/Web/Grand.Web/Features/Handlers/Catalog/GetSearchHandler.cs@@ -99,7 +99,7 @@ public class GetSearchHandler : IRequestHandler<GetSearch, SearchModel>{var categoriesModel = new List<SearchModel.CategoryModel>();//all categories- var allCategories = await _categoryService.GetAllCategories(storeId: request.Store.Id, pageSize: 100);+ var allCategories = await _categoryService.GetAllCategories(parentId: null, categoryName: "", storeId: request.Store.Id, pageSize: 100);foreach (var c in allCategories){//generate full category name (breadcrumb)@@ -136,7 +136,7 @@ public class GetSearchHandler : IRequestHandler<GetSearch, SearchModel>});}- var collections = await _collectionService.GetAllCollections(pageSize: 100);+ var collections = await _collectionService.GetAllCollections(collectionName: "", storeId: request.Store.Id, pageSize: 100);if (collections.Any()){request.Model.AvailableCollections.Add(new SelectListItem {diff --git a/src/Web/Grand.Web/Features/Handlers/Common/GetSitemapHandler.cs b/src/Web/Grand.Web/Features/Handlers/Common/GetSitemapHandler.csindex 9ec7f376b..c7fe3c4cf 100644--- a/src/Web/Grand.Web/Features/Handlers/Common/GetSitemapHandler.cs+++ b/src/Web/Grand.Web/Features/Handlers/Common/GetSitemapHandler.cs@@ -78,14 +78,14 @@ public class GetSitemapHandler : IRequestHandler<GetSitemap, SitemapModel>//categoriesif (_commonSettings.SitemapIncludeCategories){- var categories = await _categoryService.GetAllCategories(storeId: request.Store.Id);+ var categories = await _categoryService.GetAllCategories(parentId: null, categoryName: "", storeId: request.Store.Id);model.Categories = categories.Select(x => x.ToModel(request.Language)).ToList();}//collectionsif (_commonSettings.SitemapIncludeBrands){- var brands = await _brandService.GetAllBrands(storeId: request.Store.Id);+ var brands = await _brandService.GetAllBrands(brandName: "", storeId: request.Store.Id);model.Brands = brands.Select(x => x.ToModel(request.Language)).ToList();}