/// <summary> /// Cart /// </summary> /// <param name="entity"></param> /// <param name="containerSize"></param> /// <returns></returns> public ActionResult Cart(EntityModel entity, int containerSize = 0) { SetupViewData(entity, containerSize); CartWidget widget = (CartWidget)entity; widget.Cart = ECommerceContext.Cart; return(View(entity.MvcData.ViewName, entity)); }
private void SetupEcommerceLayoutWidgets(MediaModel mediaModel, LayoutModel layoutModel) { var linkedImageLogo = new LinkedImage { Name = "Logo", Link = "/", Image = mediaModel.Logo.FileUrl, LayoutArea = layoutModel.EcommerceLayout.LayoutAreas.First(x => x.AreaName == "Header Left"), Cache = true, CacheExpiryType = CacheExpiryType.Sliding, CacheLength = 60 }; _widgetService.AddWidget(linkedImageLogo); // Search var searchBox = new SearchBox { Name = "Search", LayoutArea = layoutModel.EcommerceLayout.LayoutAreas.First(x => x.AreaName == "Header Middle"), Cache = true, }; _widgetService.AddWidget(searchBox); // Ecommerce user links var userLinks = new EcommerceUserLinks { Name = "Ecommerce User Links", LayoutArea = layoutModel.EcommerceLayout.LayoutAreas.First(x => x.AreaName == "User Links") }; _widgetService.AddWidget(userLinks); //cart widget var cartWidget = new CartWidget { Name = "Cart Widget", LayoutArea = layoutModel.EcommerceLayout.LayoutAreas.First(x => x.AreaName == "Header Right") }; _widgetService.AddWidget(cartWidget); //footer links var footerLinksWidget = new TextWidget { LayoutArea = layoutModel.EcommerceLayout.LayoutAreas.First(x => x.AreaName == "Footer Area 1"), Name = "Footer links", Text = EcommerceInstallInfo.FooterText1, Cache = true, CacheExpiryType = CacheExpiryType.Sliding, CacheLength = 60 }; _widgetService.AddWidget(footerLinksWidget); footerLinksWidget = new TextWidget { LayoutArea = layoutModel.EcommerceLayout.LayoutAreas.First(x => x.AreaName == "Footer Area 2"), Name = "Footer links", Text = EcommerceInstallInfo.FooterText2, Cache = true, CacheExpiryType = CacheExpiryType.Sliding, CacheLength = 60 }; _widgetService.AddWidget(footerLinksWidget); footerLinksWidget = new TextWidget { LayoutArea = layoutModel.EcommerceLayout.LayoutAreas.First(x => x.AreaName == "Footer Area 3"), Name = "Footer links", Text = EcommerceInstallInfo.FooterText3, Cache = true, CacheExpiryType = CacheExpiryType.Sliding, CacheLength = 60 }; _widgetService.AddWidget(footerLinksWidget); var afterContentCardsTeaser = new TextWidget { LayoutArea = layoutModel.EcommerceLayout.LayoutAreas.First(x => x.AreaName == "After Content"), Name = "Footer links", Text = EcommerceInstallInfo.AfterContentCardsTeaser, Cache = true, CacheExpiryType = CacheExpiryType.Sliding, CacheLength = 60 }; _widgetService.AddWidget(afterContentCardsTeaser); var page404 = _getByUrl.GetByUrl("404"); var notFoundProducts = new On404SearchWidget { LayoutArea = layoutModel.EcommerceLayout.LayoutAreas.First(x => x.AreaName == "After Content"), Name = "What about these?", Cache = true, CacheExpiryType = CacheExpiryType.Sliding, CacheLength = 60, Webpage = page404 }; _widgetService.AddWidget(notFoundProducts); }
private void SetupEcommerceLayoutWidgets(MediaModel mediaModel, LayoutModel layoutModel) { var linkedImageLogo = new LinkedImage { Name = "Logo", Link = "/", Image = mediaModel.Logo.FileUrl, LayoutArea = layoutModel.EcommerceLayout.LayoutAreas.Single(x => x.AreaName == "Header Left"), Cache = true, CacheExpiryType = CacheExpiryType.Sliding, CacheLength = 60 }; _widgetService.AddWidget(linkedImageLogo); // Search var searchBox = new SearchBox { Name = "Search", LayoutArea = layoutModel.EcommerceLayout.LayoutAreas.Single(x => x.AreaName == "Header Middle"), Cache = true, }; _widgetService.AddWidget(searchBox); // Ecommerce user links var userLinks = new EcommerceUserLinks { Name = "Ecommerce User Links", LayoutArea = layoutModel.EcommerceLayout.LayoutAreas.Single(x => x.AreaName == "User Links") }; _widgetService.AddWidget(userLinks); //cart widget var cartWidget = new CartWidget { Name = "Cart Widget", LayoutArea = layoutModel.EcommerceLayout.LayoutAreas.Single(x => x.AreaName == "Header Right") }; _widgetService.AddWidget(cartWidget); //footer links var footerLinksWidget = new TextWidget { LayoutArea = layoutModel.EcommerceLayout.LayoutAreas.Single(x => x.AreaName == "Footer Area 1"), Name = "Footer links", Text = EcommerceInstallInfo.FooterText1, Cache = true, CacheExpiryType = CacheExpiryType.Sliding, CacheLength = 60 }; _widgetService.AddWidget(footerLinksWidget); footerLinksWidget = new TextWidget { LayoutArea = layoutModel.EcommerceLayout.LayoutAreas.Single(x => x.AreaName == "Footer Area 2"), Name = "Footer links", Text = EcommerceInstallInfo.FooterText2, Cache = true, CacheExpiryType = CacheExpiryType.Sliding, CacheLength = 60 }; _widgetService.AddWidget(footerLinksWidget); footerLinksWidget = new TextWidget { LayoutArea = layoutModel.EcommerceLayout.LayoutAreas.Single(x => x.AreaName == "Footer Area 3"), Name = "Footer links", Text = EcommerceInstallInfo.FooterText3, Cache = true, CacheExpiryType = CacheExpiryType.Sliding, CacheLength = 60 }; _widgetService.AddWidget(footerLinksWidget); var afterContentCardsTeaser = new TextWidget { LayoutArea = layoutModel.EcommerceLayout.LayoutAreas.Single(x => x.AreaName == "After Content"), Name = "Footer links", Text = EcommerceInstallInfo.AfterContentCardsTeaser, Cache = true, CacheExpiryType = CacheExpiryType.Sliding, CacheLength = 60 }; _widgetService.AddWidget(afterContentCardsTeaser); var page404 = _documentService.GetDocumentByUrl<TextPage>("404"); var notFoundProducts = new On404SearchWidget { LayoutArea = layoutModel.EcommerceLayout.LayoutAreas.Single(x => x.AreaName == "After Content"), Name = "What about these?", Cache = true, CacheExpiryType = CacheExpiryType.Sliding, CacheLength = 60, Webpage = page404 }; _widgetService.AddWidget(notFoundProducts); }