Ejemplo n.º 1
0
        /// <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}"
            }));
        }