Пример #1
0
        public ProductsPage GetProducts(string path)
        {
            var categories                    = this.products.GetCategories(path);
            var products                      = this.products.GetProducts(path);
            var favoriteIds                   = favorites.CheckFavoriteProductIds(products.Select(p => p.Id).ToList());
            var pathCategory                  = this.products.GetCategory(path);
            var bordersEnabledOnSite          = resources.GetSettingsKey("KDA_ProductThumbnailBorderEnabled").ToLower() == "true";
            var borderEnabledOnParentCategory = pathCategory?.ProductBordersEnabled ?? true; // true to handle product in the root, without parent category
            var borderStyle                   = resources.GetSettingsKey("KDA_ProductThumbnailBorderStyle");

            var productsPage = new ProductsPage
            {
                Categories = categories,
                Products   = products
            };

            productsPage.MarkFavoriteProducts(favoriteIds);
            productsPage.Products.ForEach(p => p.SetBorderInfo(bordersEnabledOnSite, borderEnabledOnParentCategory, borderStyle));

            return(productsPage);
        }
Пример #2
0
 public List <int> CheckFavoriteProductIds(List <int> productIds)
 {
     return(kenticofavorites.CheckFavoriteProductIds(productIds));
 }