/// <summary> /// Returns an enumerable collection of footer navigation items. /// </summary> public IEnumerable <TreeNode> GetFooterNavigationItems() { return(repositoryCacheHelper.CachePages(() => { var footerNavigationPage = pageRetriever.Retrieve <FooterNavigation>( query => query .Path(ContentItemIdentifiers.FOOTER_NAVIGATION, PathTypeEnum.Single) .TopN(1)) .First(); return footerNavigationPage.Fields.NavigationItems; }, $"{nameof(NavigationRepository)}|{nameof(GetFooterNavigationItems)}", new[] { CacheDependencyKeyProvider.GetDependencyCacheKeyForObjectType("cms.adhocrelationship"), $"node|{SiteContext.CurrentSiteName}|/|childnodes" })); }
/// <summary> /// Returns collection of products categorized under Hot tips page. /// </summary> /// <param name="parentAliasPath">Parent node alias path.</param> public IEnumerable <SKUTreeNode> GetHotTipProducts(string parentAliasPath) { return(RepositoryCacheHelper.CachePages(() => { var hotTipsPage = pageRetriever.Retrieve <HotTips>( query => query .Path($"{parentAliasPath}/Hot-tips", PathTypeEnum.Single) .TopN(1)) .FirstOrDefault(); return hotTipsPage?.Fields.HotTips .OfType <SKUTreeNode>() ?? Enumerable.Empty <SKUTreeNode>(); }, $"{nameof(KenticoHotTipsRepository)}|{nameof(GetHotTipProducts)}|{parentAliasPath}", new[] { CacheDependencyKeyProvider.GetDependencyCacheKeyForObjectType("cms.adhocrelationship"), CacheDependencyKeyProvider.GetDependencyCacheKeyForObjectType("ecommerce.sku"), $"node|{SiteContext.CurrentSiteName}|{parentAliasPath}" })); }
/// <summary> /// Returns the product with the specified identifier. /// </summary> /// <param name="nodeGUID">The product node identifier.</param> /// <returns>The product with the specified node identifier, if found; otherwise, null.</returns> public SKUTreeNode GetProduct(Guid nodeGUID) { return(RepositoryCacheHelper.CachePage(() => { var page = pageRetriever.Retrieve <TreeNode>( query => query .WhereEquals("NodeGUID", nodeGUID)) .FirstOrDefault(); if ((page == null) || !page.IsProduct()) { return null; } // Load product type specific fields from the database page.MakeComplete(true); return page as SKUTreeNode; }, $"{nameof(KenticoProductRepository)}|{nameof(GetProduct)}|{nodeGUID}", new[] { CacheDependencyKeyProvider.GetDependencyCacheKeyForObjectType("ecommerce.sku"), $"nodeguid|{SiteContext.CurrentSiteName}|{nodeGUID}" })); }