public virtual Link ToLiquidLink(StorefrontModel.MenuLink link, Storefront.Model.WorkContext workContext, IStorefrontUrlBuilder urlBuilder)
        {
            var result = new Link();

            result.Object = "";
            result.Title  = link.Title;
            result.Type   = "";
            result.Url    = urlBuilder.ToAppAbsolute(link.Url);

            var productLink  = link as StorefrontModel.ProductMenuLink;
            var categoryLink = link as StorefrontModel.CategoryMenuLink;

            if (productLink != null)
            {
                result.Type = "product";
                if (productLink.Product != null)
                {
                    result.Object = productLink.Product.ToShopifyModel();
                }
            }
            if (categoryLink != null)
            {
                result.Type = "collection";
                if (categoryLink.Category != null)
                {
                    result.Object = categoryLink.Category.ToShopifyModel(workContext);
                }
            }
            return(result);
        }
        public virtual Link ToLiquidLink(StorefrontModel.MenuLink link, Storefront.Model.WorkContext workContext, IStorefrontUrlBuilder urlBuilder)
        {
            var factory = ServiceLocator.Current.GetInstance <ShopifyModelFactory>();
            var result  = factory.CreateLink();

            result.InjectFrom <StorefrontModel.Common.NullableAndEnumValueInjecter>(link);

            result.Object = "";
            result.Title  = link.Title;
            result.Type   = "";
            result.Url    = urlBuilder.ToAppAbsolute(link.Url);

            var productLink  = link as StorefrontModel.ProductMenuLink;
            var categoryLink = link as StorefrontModel.CategoryMenuLink;

            if (productLink != null)
            {
                result.Type = "product";
                if (productLink.Product != null)
                {
                    result.Object = productLink.Product.ToShopifyModel();
                }
            }
            if (categoryLink != null)
            {
                result.Type = "collection";
                if (categoryLink.Category != null)
                {
                    result.Object = categoryLink.Category.ToShopifyModel(workContext);
                }
            }
            return(result);
        }
        public virtual Linklist ToLiquidLinklist(StorefrontModel.MenuLinkList linkList, Storefront.Model.WorkContext workContext, IStorefrontUrlBuilder urlBuilder)
        {
            var factory = ServiceLocator.Current.GetInstance <ShopifyModelFactory>();
            var result  = factory.CreateLinklist();

            result.InjectFrom <StorefrontModel.Common.NullableAndEnumValueInjecter>(linkList);

            result.Handle = linkList.Name;
            result.Links  = linkList.MenuLinks.Select(ml => ToLiquidLink(ml, workContext, urlBuilder)).ToList();
            result.Title  = linkList.Name;

            return(result);
        }
        public static Link ToShopfiyModel(this StorefrontModel.MenuLink link, Storefront.Model.WorkContext workContext, IStorefrontUrlBuilder urlBuilder)
        {
            var converter = ServiceLocator.Current.GetInstance <ShopifyModelConverter>();

            return(converter.ToLiquidLink(link, workContext, urlBuilder));
        }
Esempio n. 5
0
        public static Link ToShopfiyModel(this StorefrontModel.MenuLink storefrontModel, Storefront.Model.WorkContext workContext, IStorefrontUrlBuilder urlBuilder)
        {
            var shopifyModel = new Link();

            shopifyModel.Active = storefrontModel.IsActive;
            shopifyModel.Object = "";
            shopifyModel.Title  = storefrontModel.Title;
            shopifyModel.Type   = "";
            shopifyModel.Url    = urlBuilder.ToAppAbsolute(storefrontModel.Url);

            var productLink  = storefrontModel as StorefrontModel.ProductMenuLink;
            var categoryLink = storefrontModel as StorefrontModel.CategoryMenuLink;

            if (productLink != null)
            {
                shopifyModel.Type = "product";
                if (productLink.Product != null)
                {
                    shopifyModel.Object = productLink.Product.ToShopifyModel();
                }
            }
            if (categoryLink != null)
            {
                shopifyModel.Type = "collection";
                if (categoryLink.Category != null)
                {
                    shopifyModel.Object = categoryLink.Category.ToShopifyModel(workContext);
                }
            }
            return(shopifyModel);
        }
Esempio n. 6
0
        public static Linklist ToShopifyModel(this StorefrontModel.MenuLinkList storefrontModel, Storefront.Model.WorkContext workContext, IStorefrontUrlBuilder urlBuilder)
        {
            var shopifyModel = new Linklist();

            shopifyModel.Handle = storefrontModel.Name;
            shopifyModel.Id     = storefrontModel.Id;
            shopifyModel.Links  = storefrontModel.MenuLinks.Select(ml => ml.ToShopfiyModel(workContext, urlBuilder)).ToList();
            shopifyModel.Title  = storefrontModel.Name;

            return(shopifyModel);
        }
Esempio n. 7
0
        public virtual Linklist ToLiquidLinklist(StorefrontModel.MenuLinkList linkList, Storefront.Model.WorkContext workContext, IStorefrontUrlBuilder urlBuilder)
        {
            var result = new Linklist();

            result.InjectFrom <StorefrontModel.Common.NullableAndEnumValueInjecter>(linkList);

            result.Handle = linkList.Name;
            result.Links  = linkList.MenuLinks.Select(ml => ToLiquidLink(ml, workContext, urlBuilder)).ToList();
            result.Title  = linkList.Name;

            return(result);
        }
        public virtual Linklist ToLiquidLinklist(StorefrontModel.MenuLinkList linkList, Storefront.Model.WorkContext workContext, IStorefrontUrlBuilder urlBuilder)
        {
            var result = new Linklist();

            result.Id     = linkList.Id;
            result.Handle = linkList.Name.Handelize();
            result.Links  = linkList.MenuLinks.Select(ml => ToLiquidLink(ml, workContext, urlBuilder)).ToList();
            result.Title  = linkList.Name;

            return(result);
        }
        public static Link ToShopfiyModel(this StorefrontModel.MenuLink link, Storefront.Model.WorkContext workContext, IStorefrontUrlBuilder urlBuilder)
        {
            var converter = new ShopifyModelConverter();

            return(converter.ToLiquidLink(link, workContext, urlBuilder));
        }