Bug at the GetManufacturersByCategoryIdAsync() method if the products are constrainted to ACL

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
1 year ago
The
GetManufacturersByCategoryIdAsync()
method cache the manyfacturers of the category. The cache key only has the category id as the parameter

var key = _staticCacheManager
                .PrepareKeyForDefaultCache(NopCatalogDefaults.ManufacturersByCategoryCacheKey, categoryId.ToString());


The problem occurs when the products has ACL constraints. Since the ACL constraint limits different products to different customer roles, the product list can be differnet for diifferent customer thus the manufacturers available for those products will be different. But because of the caching via category id, the first request is cached and the same list of manufacturers are served  to all the customers . So the cache key should take the customer role/id into consideration incase the ACL constraint is applied.
1 year ago
Also the storemapping constraint may need to be considered here
1 year ago
Hi. It looks like you are right, I created a task and will solve this problem in the near future

sanju.dahal741 wrote:
The
GetManufacturersByCategoryIdAsync()
method cache the manyfacturers of the category. The cache key only has the category id as the parameter

var key = _staticCacheManager
                .PrepareKeyForDefaultCache(NopCatalogDefaults.ManufacturersByCategoryCacheKey, categoryId.ToString());


The problem occurs when the products has ACL constraints. Since the ACL constraint limits different products to different customer roles, the product list can be differnet for diifferent customer thus the manufacturers available for those products will be different. But because of the caching via category id, the first request is cached and the same list of manufacturers are served  to all the customers . So the cache key should take the customer role/id into consideration incase the ACL constraint is applied.
1 year ago
In general, I think all keys in the app should be checked, as similar issues / complexities could exist - e.g.
https://www.nopcommerce.com/en/boards/topic/95191/cacheproductprices-should-not-be-enabled-if-we-use-complex-discount-requirements-why#300525
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.