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; }
public static Link ToShopfiyModel(this StorefrontModel.MenuLink storefrontModel) { var shopifyModel = new Link(); shopifyModel.Active = storefrontModel.IsActive; shopifyModel.Object = ""; shopifyModel.Title = storefrontModel.Title; shopifyModel.Type = ""; shopifyModel.Url = storefrontModel.Url; return shopifyModel; }