public ActionResult Show(ShowWishlist page, string id) { if (!MrCMSApplication.Get <EcommerceSettings>().EnableWishlists) { return(Redirect("/")); } var wishlist = _wishlistUIService.GetWishlist(id); if (wishlist == null) { return(Redirect("~")); } ViewData["wishlist"] = wishlist; ViewData["my-wishlist"] = string.IsNullOrWhiteSpace(id); ViewData["cart"] = _cartModel; return(View(page)); }
public PageModel Setup(MediaModel mediaModel) { var pageModel = new PageModel(); var productSearch = new ProductSearch { Name = "Categories", UrlSegment = "categories", RevealInNavigation = true }; var categoryContainer = new ProductContainer { Name = "Products", UrlSegment = "products", RevealInNavigation = false }; _webpageAdminService.Add(productSearch); _webpageAdminService.PublishNow(productSearch); _webpageAdminService.Add(categoryContainer); _webpageAdminService.PublishNow(categoryContainer); pageModel.ProductSearch = productSearch; var now = DateTime.UtcNow; var yourBasket = new Cart { Name = "Your Basket", UrlSegment = "basket", RevealInNavigation = false, PublishOn = now }; _webpageAdminService.Add(yourBasket); var enterOrderEmail = new EnterOrderEmail { Name = "Enter Order Email", UrlSegment = "enter-order-email", RevealInNavigation = false, Parent = yourBasket, DisplayOrder = 0, PublishOn = now, }; _webpageAdminService.Add(enterOrderEmail); var setPaymentDetails = new PaymentDetails { Name = "Set Payment Details", UrlSegment = "set-payment-details", RevealInNavigation = false, Parent = yourBasket, DisplayOrder = 1, PublishOn = now, }; _webpageAdminService.Add(setPaymentDetails); var setDeliveryDetails = new SetShippingDetails { Name = "Set Shipping Details", UrlSegment = "set-shipping-details", RevealInNavigation = false, Parent = yourBasket, DisplayOrder = 2, PublishOn = now, }; _webpageAdminService.Add(setDeliveryDetails); var orderPlaced = new OrderPlaced { Name = "Order Placed", UrlSegment = "order-placed", RevealInNavigation = false, Parent = yourBasket, DisplayOrder = 3, PublishOn = now, }; _webpageAdminService.Add(orderPlaced); // User Account var userAccount = new SitemapPlaceholder { Name = "User Account", UrlSegment = "user-account", RevealInNavigation = false, PublishOn = now }; _webpageAdminService.Add(userAccount); var userAccountInfo = new UserAccountInfo { Name = "Account Details", UrlSegment = "user-account-details", RevealInNavigation = false, PublishOn = now, Parent = userAccount }; _webpageAdminService.Add(userAccountInfo); var userAccountPassword = new UserAccountChangePassword { Name = "Change Password", UrlSegment = "user-account-change-password", RevealInNavigation = false, PublishOn = now, Parent = userAccount }; _webpageAdminService.Add(userAccountPassword); var userAccountAddresses = new UserAccountAddresses { Name = "Account Addresses", UrlSegment = "user-account-addresses", RevealInNavigation = false, PublishOn = now, Parent = userAccount }; _webpageAdminService.Add(userAccountAddresses); var editAddress = new UserAccountEditAddress { Name = "Edit Address", UrlSegment = userAccountAddresses.UrlSegment + "/edit-address", RevealInNavigation = false, PublishOn = now, Parent = userAccountAddresses }; _webpageAdminService.Add(editAddress); var userAccountOrders = new UserAccountOrders { Name = "Orders", UrlSegment = "user-account-orders", RevealInNavigation = false, PublishOn = now, Parent = userAccount }; _webpageAdminService.Add(userAccountOrders); var userOrder = new UserOrder { Name = "View Order", UrlSegment = "user-account-orders/order", RevealInNavigation = false, PublishOn = now, Parent = userAccountOrders }; _webpageAdminService.Add(userOrder); var userAccountReviews = new UserAccountReviews { Name = "Reviews", UrlSegment = "user-account-reviews", RevealInNavigation = false, PublishOn = now, Parent = userAccount }; _webpageAdminService.Add(userAccountReviews); var userAccountRewards = new UserAccountRewardPoints { Name = "Reward Points", UrlSegment = "user-account-reward-points", RevealInNavigation = false, PublishOn = now, Parent = userAccount }; _webpageAdminService.Add(userAccountRewards); // End User Account //Added to cart var addedToCart = new ProductAddedToCart { Name = "Added to Basket", UrlSegment = "add-to-basket", RevealInNavigation = false, PublishOn = now }; _webpageAdminService.Add(addedToCart); pageModel.ProductAddedToCart = addedToCart; var wishlist = new ShowWishlist { Name = "Wishlist", UrlSegment = "wishlist", RevealInNavigation = true, PublishOn = now }; _webpageAdminService.Add(wishlist); var newIn = new NewInProducts { Name = "New In", UrlSegment = "new-in", RevealInNavigation = true, PublishOn = now }; _webpageAdminService.Add(newIn); var about = new TextPage() { Name = "About us", UrlSegment = "about-us", RevealInNavigation = true, PublishOn = now, BodyContent = EcommerceInstallInfo.AboutUsText }; _webpageAdminService.Add(about); //update core pages var homePage = _getByUrl.GetByUrl("home"); if (homePage != null) { homePage.BodyContent = EcommerceInstallInfo.HomeCopy; var templates = _pageTemplateAdminService.Search(new PageTemplateSearchQuery()); var homeTemplate = templates.FirstOrDefault(x => x.Name == "Home Page"); if (homeTemplate != null) { homePage.PageTemplate = homeTemplate; } homePage.SubmitButtonText = "Sign up"; _webpageAdminService.Update(homePage); pageModel.HomePage = homePage; } var page2 = _getByUrl.GetByUrl("page-2"); if (page2 != null)//demopage in core not needed { _webpageAdminService.Delete(page2); } var contactus = _getByUrl.GetByUrl("contact-us"); if (contactus != null)//demopage in core not needed { _webpageAdminService.Delete(contactus); } //Added to cart var contactUs = new ContactUs() { Name = "Contact Us", UrlSegment = "contact-us", RevealInNavigation = true, PublishOn = now, Latitude = 55.01021m, Longitude = -1.44998m, Address = EcommerceInstallInfo.Address, PinImage = mediaModel.Logo.FileUrl, BodyContent = "[form]", FormDesign = EcommerceInstallInfo.ContactFormDesign }; _webpageAdminService.Add(contactUs); GetFormProperties(contactUs); var brandListing = new BrandListing { Name = "Brands", UrlSegment = "brands", RevealInNavigation = true, PublishOn = now, BodyContent = "" }; _webpageAdminService.Add(brandListing); return(pageModel); }
public PageModel Setup(MediaModel mediaModel) { var pageModel = new PageModel(); var productSearch = new ProductSearch { Name = "Categories", UrlSegment = "categories", RevealInNavigation = true }; var categoryContainer = new ProductContainer { Name = "Products", UrlSegment = "products", RevealInNavigation = false }; _documentService.AddDocument(productSearch); _documentService.PublishNow(productSearch); _documentService.AddDocument(categoryContainer); _documentService.PublishNow(categoryContainer); pageModel.ProductSearch = productSearch; var now = DateTime.UtcNow; var yourBasket = new Cart { Name = "Your Basket", UrlSegment = "basket", RevealInNavigation = false, PublishOn = now }; _documentService.AddDocument(yourBasket); var enterOrderEmail = new EnterOrderEmail { Name = "Enter Order Email", UrlSegment = "enter-order-email", RevealInNavigation = false, Parent = yourBasket, DisplayOrder = 0, PublishOn = now, }; _documentService.AddDocument(enterOrderEmail); var setPaymentDetails = new PaymentDetails { Name = "Set Payment Details", UrlSegment = "set-payment-details", RevealInNavigation = false, Parent = yourBasket, DisplayOrder = 1, PublishOn = now, }; _documentService.AddDocument(setPaymentDetails); var setDeliveryDetails = new SetShippingDetails { Name = "Set Shipping Details", UrlSegment = "set-shipping-details", RevealInNavigation = false, Parent = yourBasket, DisplayOrder = 2, PublishOn = now, }; _documentService.AddDocument(setDeliveryDetails); var orderPlaced = new OrderPlaced { Name = "Order Placed", UrlSegment = "order-placed", RevealInNavigation = false, Parent = yourBasket, DisplayOrder = 3, PublishOn = now, }; _documentService.AddDocument(orderPlaced); // User Account var userAccount = new SitemapPlaceholder { Name = "User Account", UrlSegment = "user-account", RevealInNavigation = false, PublishOn = now }; _documentService.AddDocument(userAccount); var userAccountInfo = new UserAccountInfo { Name = "Account Details", UrlSegment = "user-account-details", RevealInNavigation = false, PublishOn = now, Parent = userAccount }; _documentService.AddDocument(userAccountInfo); var userAccountPassword = new UserAccountChangePassword { Name = "Change Password", UrlSegment = "user-account-change-password", RevealInNavigation = false, PublishOn = now, Parent = userAccount }; _documentService.AddDocument(userAccountPassword); var userAccountAddresses = new UserAccountAddresses { Name = "Account Addresses", UrlSegment = "user-account-addresses", RevealInNavigation = false, PublishOn = now, Parent = userAccount }; _documentService.AddDocument(userAccountAddresses); var editAddress = new UserAccountEditAddress { Name = "Edit Address", UrlSegment = userAccountAddresses.UrlSegment + "/edit-address", RevealInNavigation = false, PublishOn = now, Parent = userAccountAddresses }; _documentService.AddDocument(editAddress); var userAccountOrders = new UserAccountOrders { Name = "Orders", UrlSegment = "user-account-orders", RevealInNavigation = false, PublishOn = now, Parent = userAccount }; _documentService.AddDocument(userAccountOrders); var userOrder = new UserOrder { Name = "View Order", UrlSegment = "user-account-orders/order", RevealInNavigation = false, PublishOn = now, Parent = userAccountOrders }; _documentService.AddDocument(userOrder); var userAccountReviews = new UserAccountReviews { Name = "Reviews", UrlSegment = "user-account-reviews", RevealInNavigation = false, PublishOn = now, Parent = userAccount }; _documentService.AddDocument(userAccountReviews); var userAccountRewards = new UserAccountRewardPoints { Name = "Reward Points", UrlSegment = "user-account-reward-points", RevealInNavigation = false, PublishOn = now, Parent = userAccount }; _documentService.AddDocument(userAccountRewards); // End User Account //Added to cart var addedToCart = new ProductAddedToCart { Name = "Added to Basket", UrlSegment = "add-to-basket", RevealInNavigation = false, PublishOn = now }; _documentService.AddDocument(addedToCart); pageModel.ProductAddedToCart = addedToCart; var wishlist = new ShowWishlist { Name = "Wishlist", UrlSegment = "wishlist", RevealInNavigation = true, PublishOn = now }; _documentService.AddDocument(wishlist); var newIn = new NewInProducts { Name = "New In", UrlSegment = "new-in", RevealInNavigation = true, PublishOn = now }; _documentService.AddDocument(newIn); var about = new TextPage() { Name = "About us", UrlSegment = "about-us", RevealInNavigation = true, PublishOn = now, BodyContent = EcommerceInstallInfo.AboutUsText }; _documentService.AddDocument(about); //update core pages var homePage = _documentService.GetDocumentByUrl<TextPage>("home"); if (homePage != null) { homePage.BodyContent = EcommerceInstallInfo.HomeCopy; var templates = _pageTemplateAdminService.Search(new PageTemplateSearchQuery()); var homeTemplate = templates.FirstOrDefault(x => x.Name == "Home Page"); if (homeTemplate != null) { homePage.PageTemplate = homeTemplate; } homePage.SubmitButtonText = "Sign up"; _documentService.SaveDocument(homePage); pageModel.HomePage = homePage; } var page2 = _documentService.GetDocumentByUrl<TextPage>("page-2"); if (page2 != null)//demopage in core not needed _documentService.DeleteDocument(page2); var contactus = _documentService.GetDocumentByUrl<TextPage>("contact-us"); if (contactus != null)//demopage in core not needed _documentService.DeleteDocument(contactus); //Added to cart var contactUs = new ContactUs() { Name = "Contact Us", UrlSegment = "contact-us", RevealInNavigation = true, PublishOn = now, Latitude = 55.01021m, Longitude = -1.44998m, Address = EcommerceInstallInfo.Address, PinImage = mediaModel.Logo.FileUrl, BodyContent = "[form]", FormDesign = EcommerceInstallInfo.ContactFormDesign }; _documentService.AddDocument(contactUs); GetFormProperties(contactUs); var brandListing = new BrandListing { Name = "Brands", UrlSegment = "brands", RevealInNavigation = true, PublishOn = now, BodyContent = "" }; _documentService.AddDocument(brandListing); return pageModel; }