예제 #1
0
        /// <summary>
        /// Get the size guide for the product
        /// </summary>
        /// <param name="currentContent"></param>
        /// <returns></returns>
        protected int GetSizeGuide(FashionProductContent currentContent)
        {
            int output = UrlHelpers.GetReferenceFromUrl(currentContent.SizeGuide);

            if (output > 0)
            {
                return(output);
            }

            var ancestors = ContentLoader.GetAncestors(currentContent.ContentLink);

            foreach (var ancestor in ancestors)
            {
                var content = ContentLoader.Get <IContent>(ancestor.ContentLink);
                if (content is FashionStoreSubLandingNodeContent)
                {
                    output = UrlHelpers.GetReferenceFromUrl(((FashionStoreSubLandingNodeContent)content).SizeGuide);
                }
                else if (content is FashionStoreLandingNodeContent)
                {
                    output = UrlHelpers.GetReferenceFromUrl(((FashionStoreLandingNodeContent)content).SizeGuide);
                }
                if (output > 0)
                {
                    return(output);
                }
            }
            return(-1);
        }