Ejemplo n.º 1
0
 private void SetFeaturedCategories(MediaModel model)
 {
     var cat1 = _documentService.GetDocumentByUrl<Category>(FeaturedCategoriesInfo.Category1Url);
     var cat2 = _documentService.GetDocumentByUrl<Category>(FeaturedCategoriesInfo.Category2Url);
     var cat3 = _documentService.GetDocumentByUrl<Category>(FeaturedCategoriesInfo.Category3Url);
     var cat4 = _documentService.GetDocumentByUrl<Category>(FeaturedCategoriesInfo.Category4Url);
     if (cat1 != null)
     {
         cat1.FeatureImage = model.FeaturedCategory1.FileUrl;
         _documentService.SaveDocument(cat1);
     }
     if (cat2 != null)
     {
         cat2.FeatureImage = model.FeaturedCategory2.FileUrl;
         _documentService.SaveDocument(cat2);
     }
     if (cat3 != null)
     {
         cat3.FeatureImage = model.FeaturedCategory3.FileUrl;
         _documentService.SaveDocument(cat3);
     }
     if (cat4 != null)
     {
         cat4.FeatureImage = model.FeaturedCategory4.FileUrl;
         _documentService.SaveDocument(cat4);
     }
 }
Ejemplo n.º 2
0
        public void Setup(MediaModel mediaModel)
        {
            var siteSettings = _configurationProvider.GetSiteSettings<SiteSettings>();
            var documentByUrl = _documentService.GetDocumentByUrl<Layout>("_ContentLayout");
            if (documentByUrl != null)
                siteSettings.DefaultLayoutId = documentByUrl.Id;
            siteSettings.ThemeName = "Ecommerce";
            _configurationProvider.SaveSettings(siteSettings);

            var ecommerceSettings = _configurationProvider.GetSiteSettings<EcommerceSettings>();
            ecommerceSettings.SearchProductsPerPage = "12,20,40";
            ecommerceSettings.PreviousPriceText = "Was";
            ecommerceSettings.DefaultNoProductImage = mediaModel.AwatiginImage.FileUrl;
            ecommerceSettings.EnableWishlists = true;

            ecommerceSettings.ProductUrl = "product/{0}";
            ecommerceSettings.CategoryUrl = "category/{0}";
            ecommerceSettings.BrandUrl = "brand/{0}";

            _configurationProvider.SaveSettings(ecommerceSettings);

            var paymentSettings = _configurationProvider.GetSiteSettings<PaymentSettings>();
            paymentSettings.CashOnDeliveryEnabled = true;
            _configurationProvider.SaveSettings(paymentSettings);
        }
Ejemplo n.º 3
0
        public void Setup(PageModel pageModel, MediaModel mediaModel, LayoutModel layoutModel)
        {

            SetupEcommerceLayoutWidgets(mediaModel, layoutModel);
            SetupHomeLayoutWidgets(pageModel, mediaModel, layoutModel);
            SetupSearchLayoutWidgets(pageModel, layoutModel);
            SetupCheckoutLayoutWidgets(mediaModel, layoutModel);
            SetupProductLayoutWidgets(layoutModel, pageModel);
        }
Ejemplo n.º 4
0
        public void Import(MediaModel model)
        {
            var memoryStream = new MemoryStream(EcommerceInstallHelper.GetFileFromUrl(EcommerceInstallInfo.CategoryExcelUrl));
            var result = _importExportManager.ImportDocumentsFromExcel(memoryStream, false);
            
            var batchRun = result.Batch.BatchRuns.First();
            _synchronousBatchRunExecution.Execute(batchRun);

            SetFeaturedCategories(model);
        }
Ejemplo n.º 5
0
        public MediaModel Setup()
        {
            var model = new MediaModel();

            var defaultMediaCategory = _documentService.GetDocumentByUrl<MediaCategory>("default");
            try
            {
                var memoryStream = new MemoryStream(EcommerceInstallHelper.GetFileFromUrl(EcommerceInstallInfo.LogoImageUrl));
                model.Logo = _fileService.AddFile(memoryStream, "logo.png", "image/png", memoryStream.Length, defaultMediaCategory);

                memoryStream = new MemoryStream(EcommerceInstallHelper.GetFileFromUrl(EcommerceInstallInfo.Slide1ImageUrl));
                model.SliderImage1 = _fileService.AddFile(memoryStream, "slide1.jpg", "image/jpeg", memoryStream.Length, defaultMediaCategory);

                memoryStream = new MemoryStream(EcommerceInstallHelper.GetFileFromUrl(EcommerceInstallInfo.Slide2ImageUrl));
                model.SliderImage2 = _fileService.AddFile(memoryStream, "slide2.jpg", "image/jpeg", memoryStream.Length, defaultMediaCategory);

                memoryStream = new MemoryStream(EcommerceInstallHelper.GetFileFromUrl(EcommerceInstallInfo.DeliveryIcon));
                model.DeliveryIcon = _fileService.AddFile(memoryStream, "delivery.gif", "image/gif", memoryStream.Length, defaultMediaCategory);

                memoryStream = new MemoryStream(EcommerceInstallHelper.GetFileFromUrl(EcommerceInstallInfo.ReturnIcon));
                model.ReturnIcon = _fileService.AddFile(memoryStream, "return.gif", "image/gif", memoryStream.Length, defaultMediaCategory);

                memoryStream = new MemoryStream(EcommerceInstallHelper.GetFileFromUrl(EcommerceInstallInfo.LocationIcon));
                model.LocationIcon = _fileService.AddFile(memoryStream, "location.gif", "image/gif", memoryStream.Length, defaultMediaCategory);

                memoryStream = new MemoryStream(EcommerceInstallHelper.GetFileFromUrl(EcommerceInstallInfo.ContactIcon));
                model.ContactIcon = _fileService.AddFile(memoryStream, "contact.gif", "image/gif", memoryStream.Length, defaultMediaCategory);

                //featured category images
                memoryStream = new MemoryStream(EcommerceInstallHelper.GetFileFromUrl(FeaturedCategoriesInfo.Category1ImageUrl));
                model.FeaturedCategory1 = _fileService.AddFile(memoryStream, "cat1.jpg", "image/jpeg", memoryStream.Length, defaultMediaCategory);

                memoryStream = new MemoryStream(EcommerceInstallHelper.GetFileFromUrl(FeaturedCategoriesInfo.Category2ImageUrl));
                model.FeaturedCategory2 = _fileService.AddFile(memoryStream, "cat2.jpg", "image/jpeg", memoryStream.Length, defaultMediaCategory);
                
                memoryStream = new MemoryStream(EcommerceInstallHelper.GetFileFromUrl(FeaturedCategoriesInfo.Category3ImageUrl));
                model.FeaturedCategory3 = _fileService.AddFile(memoryStream, "cat3.jpg", "image/jpeg", memoryStream.Length, defaultMediaCategory);

                memoryStream = new MemoryStream(EcommerceInstallHelper.GetFileFromUrl(FeaturedCategoriesInfo.Category4ImageUrl));
                model.FeaturedCategory4 = _fileService.AddFile(memoryStream, "cat4.jpg", "image/jpeg", memoryStream.Length, defaultMediaCategory);

                memoryStream = new MemoryStream(EcommerceInstallHelper.GetFileFromUrl(FeaturedCategoriesInfo.SecureCheckout));
                model.SecureCheckout = _fileService.AddFile(memoryStream, "secure-checkout.png", "image/png", memoryStream.Length, defaultMediaCategory);

            }
            catch (Exception ex) { }

            var imgPath = HttpContext.Current.Server.MapPath(EcommerceInstallInfo.AwatingImageUrl);
            var fileStream = new FileStream(imgPath, FileMode.Open);
            model.AwatiginImage = _fileService.AddFile(fileStream, Path.GetFileName(imgPath), "image/jpeg", fileStream.Length, defaultMediaCategory);

            return model;
        }
Ejemplo n.º 6
0
        private void SetupCheckoutLayoutWidgets(MediaModel mediaModel, LayoutModel layoutModel)
        {
            //checkout images
            var checkoutLogo = new LinkedImage
            {
                Image = _fileService.GetFileLocation(mediaModel.Logo, new Size { Width = 200, Height = 200 }),
                Link = "/",
                LayoutArea = layoutModel.CheckoutLayout.LayoutAreas.Single(x => x.AreaName == "Checkout Header Left"),
                Cache = true,
                CacheExpiryType = CacheExpiryType.Sliding,
                CacheLength = 60
            };
            _widgetService.AddWidget(checkoutLogo);

            var checkoutSecureBadge = new LinkedImage
            {
                Image = mediaModel.SecureCheckout.FileUrl,
                LayoutArea = layoutModel.CheckoutLayout.LayoutAreas.Single(x => x.AreaName == "Checkout Header Middle"),
                Cache = true,
                CacheExpiryType = CacheExpiryType.Sliding,
                CacheLength = 60
            };
            _widgetService.AddWidget(checkoutSecureBadge);
        }
Ejemplo n.º 7
0
        public LayoutModel Setup(MediaModel mediaModel)
        {
            var layoutModel = new LayoutModel();
            //base layout
            var baseLayout = new Layout
            {
                Name = "Base Ecommerce Layout",
                UrlSegment = "_BaseEcommerceLayout",
                LayoutAreas = new List<LayoutArea>(),
            };
            _documentService.AddDocument(baseLayout);

            //ecommerce main layout
            var eCommerceLayout = new Layout
            {
                Name = "Ecommerce Layout",
                UrlSegment = "_EcommerceLayout",
                LayoutAreas = new List<LayoutArea>(),
                Parent = baseLayout
            };
            var ecommerceLayoutArea = new List<LayoutArea>
            {
                new LayoutArea {AreaName = "Header Left", Layout = eCommerceLayout},
                new LayoutArea {AreaName = "Header Middle", Layout = eCommerceLayout},
                new LayoutArea {AreaName = "Header Right", Layout = eCommerceLayout},
                new LayoutArea {AreaName = "User Links", Layout = eCommerceLayout},
                new LayoutArea {AreaName = "Navigation", Layout = eCommerceLayout},
                new LayoutArea {AreaName = "Before Content", Layout = eCommerceLayout},
                new LayoutArea {AreaName = "After Content", Layout = eCommerceLayout},
                new LayoutArea {AreaName = "Footer Area 1", Layout = eCommerceLayout},
                new LayoutArea {AreaName = "Footer Area 2", Layout = eCommerceLayout},
                new LayoutArea {AreaName = "Footer Area 3", Layout = eCommerceLayout},
                new LayoutArea {AreaName = "Footer Area 4", Layout = eCommerceLayout}
            };

            _documentService.AddDocument(eCommerceLayout);
            foreach (LayoutArea area in ecommerceLayoutArea)
                _layoutAreaAdminService.SaveArea(area);

            layoutModel.EcommerceLayout = eCommerceLayout;

            var homeLayout = new Layout
            {
                Name = "Home Layout",
                UrlSegment = "_HomeLayout",
                LayoutAreas = new List<LayoutArea>(),
                Parent = eCommerceLayout
            };
            var homeLayoutAreas = new List<LayoutArea>
            {
                new LayoutArea {AreaName = "Home After Content", Layout = homeLayout},
                new LayoutArea {AreaName = "Teaser1", Layout = homeLayout},
                new LayoutArea {AreaName = "Teaser2", Layout = homeLayout},
                new LayoutArea {AreaName = "Teaser3", Layout = homeLayout},
                new LayoutArea {AreaName = "Teaser4", Layout = homeLayout}
            };
            _documentService.AddDocument(homeLayout);
            foreach (LayoutArea area in homeLayoutAreas)
                _layoutAreaAdminService.SaveArea(area);
            layoutModel.HomeLayout = homeLayout;
            //checkout layout
            var checkoutLayout = new Layout
            {
                Name = "Checkout Layout",
                UrlSegment = "_CheckoutLayout",
                LayoutAreas = new List<LayoutArea>(),
                Parent = eCommerceLayout
            };
            var checkoutLayoutAreas = new List<LayoutArea>
            {
                new LayoutArea {AreaName = "Checkout Header Left", Layout = checkoutLayout},
                new LayoutArea {AreaName = "Checkout Header Middle", Layout = checkoutLayout},
                new LayoutArea {AreaName = "Checkout Header Right", Layout = checkoutLayout},
                new LayoutArea {AreaName = "Checkout Footer Left", Layout = checkoutLayout},
                new LayoutArea {AreaName = "Checkout Footer Right", Layout = checkoutLayout}
            };
            _documentService.AddDocument(checkoutLayout);

            foreach (LayoutArea area in checkoutLayoutAreas)
                _layoutAreaAdminService.SaveArea(area);
            layoutModel.CheckoutLayout = checkoutLayout;
            //product layout
            var productLayout = new Layout
            {
                Name = "Product Layout",
                UrlSegment = "_ProductLayout",
                LayoutAreas = new List<LayoutArea>(),
                Parent = eCommerceLayout
            };
            var productLayoutAreas = new List<LayoutArea>
            {
                new LayoutArea {AreaName = "Below Product Price", Layout = productLayout},
                new LayoutArea {AreaName = "Below Add to cart", Layout = productLayout},
                new LayoutArea {AreaName = "Below Product Information", Layout = productLayout},
                new LayoutArea {AreaName = "Before Product Content", Layout = productLayout},
                new LayoutArea {AreaName = "After Product Content", Layout = productLayout}
            };

            _documentService.AddDocument(productLayout);
            foreach (LayoutArea area in productLayoutAreas)
                _layoutAreaAdminService.SaveArea(area);
            layoutModel.ProductLayout = productLayout;
            //category/search layout
            var searchLayout = new Layout
            {
                Name = "Search Layout",
                UrlSegment = "_SearchLayout",
                LayoutAreas = new List<LayoutArea>(),
                Parent = eCommerceLayout
            };
            var searchLayoutAreas = new List<LayoutArea>
            {
                new LayoutArea {AreaName = "Before Filters", Layout = searchLayout},
                new LayoutArea {AreaName = "After Filters", Layout = searchLayout}
            };

            _documentService.AddDocument(searchLayout);
            foreach (LayoutArea area in searchLayoutAreas)
                _layoutAreaAdminService.SaveArea(area);
            layoutModel.SearchLayout = searchLayout;

            var contentLayout = new Layout
            {
                Name = "Content Layout",
                UrlSegment = "_ContentLayout",
                LayoutAreas = new List<LayoutArea>(),
                Parent = eCommerceLayout
            };
            _documentService.AddDocument(contentLayout);
            layoutModel.ContentLayout = contentLayout;

            // UserAccount
            var userAccountLayout = new Layout
            {
                Name = "User Account Layout",
                UrlSegment = "_UserAccountLayout",
                LayoutAreas = new List<LayoutArea>(),
                Parent = eCommerceLayout
            };
            var userAccountAreas = new List<LayoutArea>
            {
                new LayoutArea {AreaName = "Right Column", Layout = userAccountLayout}
            };
            _documentService.AddDocument(userAccountLayout);
            foreach (LayoutArea area in userAccountAreas)
                _layoutAreaAdminService.SaveArea(area);
            layoutModel.UserAccountLayout = userAccountLayout;

            //Page templates
            var homeTemplate = new PageTemplate
            {
                Name = "Home Page",
                PageType = typeof (TextPage).FullName,
                UrlGeneratorType = typeof(DefaultWebpageUrlGenerator).FullName,
                Layout = homeLayout
            };
            _pageTemplateAdminService.Add(homeTemplate);

            SetPageDefaults(layoutModel);

            return layoutModel;
        }
Ejemplo n.º 8
0
        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;
        }
Ejemplo n.º 9
0
        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);
        }
Ejemplo n.º 10
0
        private void SetupHomeLayoutWidgets(PageModel pageModel, MediaModel mediaModel, LayoutModel layoutModel)
        {
            var layout = layoutModel.HomeLayout;
            var beforeContent = layoutModel.EcommerceLayout.LayoutAreas.FirstOrDefault(x => x.AreaName == "Before Content");
            var teaser1Area = layout.LayoutAreas.FirstOrDefault(x => x.AreaName == "Teaser1");
            var teaser2Area = layout.LayoutAreas.FirstOrDefault(x => x.AreaName == "Teaser2");
            var teaser3Area = layout.LayoutAreas.FirstOrDefault(x => x.AreaName == "Teaser3");
            var teaser4Area = layout.LayoutAreas.FirstOrDefault(x => x.AreaName == "Teaser4");

            var slider = new Slider
            {
                Image = mediaModel.SliderImage1.FileUrl,
                Image1 = mediaModel.SliderImage2.FileUrl,
                LayoutArea = beforeContent,
                Webpage = pageModel.HomePage,
                Cache = true,
                CacheExpiryType = CacheExpiryType.Sliding,
                CacheLength = 1800
            };
            _widgetService.AddWidget(slider);

            var featuredProducts = new FeaturedProducts
            {
                LayoutArea = beforeContent,
                Webpage = pageModel.HomePage,
                ListOfFeaturedProducts = GetFeaturedProducts(),
                Name = "Featured Products",
                Cache = true,
                CacheExpiryType = CacheExpiryType.Sliding,
                CacheLength = 1800
            };
            _widgetService.AddWidget(featuredProducts);

            //nav
            var nav = new MobileFriendlyNavigation.Widgets.MobileFriendlyNavigation
            {
                Name = "Navigation",
                LayoutArea = layoutModel.EcommerceLayout.LayoutAreas.Single(x => x.AreaName == ("Navigation")),
                IncludeChildren = true,
                Cache = true,
                CacheExpiryType = CacheExpiryType.Sliding,
                CacheLength = 60
            };
            _widgetService.AddWidget(nav);

            var featuredCategories = new FeaturedCategories
            {
                LayoutArea = beforeContent,
                Webpage = pageModel.HomePage,
                ListOfFeaturedCategories = GetFeaturedCategories(),
                Name = "Featured Categories",
                Cache = true,
                CacheExpiryType = CacheExpiryType.Sliding,
                CacheLength = 1800
            };
            _widgetService.AddWidget(featuredCategories);

            var teaser1 = new TextWidget()
            {
                LayoutArea = teaser1Area,
                Webpage = pageModel.HomePage,
                Text = string.Format(@"<div class=""padding-bottom-10""><span><img src=""{0}"" /> </span></div><h3><a href=""#"">FREE delivery on orders over &pound;50. </a></h3><p>Orders placed Monday to Friday before 2pm will generally be picked and packed for immediate despatch. Please note that orders placed over the weekend or on public holidays will be processed on the next working day.</p>", mediaModel.DeliveryIcon.FileUrl),
                Cache = true,
                CacheExpiryType = CacheExpiryType.Sliding,
                CacheLength = 1800
                
            };
            _widgetService.AddWidget(teaser1);

            var teaser2 = new TextWidget()
            {
                LayoutArea = teaser2Area,
                Webpage = pageModel.HomePage,
                Text = string.Format(@"<div class=""padding-bottom-10""><span><img src=""{0}"" /> </span></div><h3><a href=""#"">7 day no question returns.</a></h3><p>We offer a 28 Day Money Back Guarantee. If for any reason you are not completely delighted with your purchase you may download a Returns Form and return it within 28 days of receipt for a full refund or exchange.</p>", mediaModel.ReturnIcon.FileUrl),
                Cache = true,
                CacheExpiryType = CacheExpiryType.Sliding,
                CacheLength = 1800
                
            };
            _widgetService.AddWidget(teaser2);

            var teaser3 = new TextWidget()
            {
                LayoutArea = teaser3Area,
                Webpage = pageModel.HomePage,
                Text = string.Format(@"<div class=""padding-bottom-10""><span><img src=""{0}"" /> </span></div><h3><a href=""#"">Store locations.</a></h3><p>Use our store locator to find a store near you as well as information like opening times, addresses, maps and a list of facilities available at every store.</p>", mediaModel.LocationIcon.FileUrl),
                Cache = true,
                CacheExpiryType = CacheExpiryType.Sliding,
                CacheLength = 1800
                
            };
            _widgetService.AddWidget(teaser3);

            var teaser4 = new TextWidget()
            {
                LayoutArea = teaser4Area,
                Webpage = pageModel.HomePage,
                Text = string.Format(@"<div class=""padding-bottom-10""><span><img src=""{0}"" /> </span></div><h3><a href=""#"">Contact us.</a></h3><p>Our customer service team is always willing to answer your proposal concerning Samsung Service. Your message will be promptly handled under the direct supervision of our executive management.</p>", mediaModel.ContactIcon.FileUrl),
                Cache = true,
                CacheExpiryType = CacheExpiryType.Sliding,
                CacheLength = 60
            };
            _widgetService.AddWidget(teaser4);

            GetFormProperties(pageModel.HomePage);
            //home footer form
            var footerLinksWidgetForm = new TextWidget
            {
                LayoutArea = layoutModel.EcommerceLayout.LayoutAreas.Single(x => x.AreaName == "Footer Area 4"),
                Name = "Footer links",
                Text = string.Format("[form-{0}]", pageModel.HomePage.Id),
                Cache = true,
                CacheExpiryType = CacheExpiryType.Sliding,
                CacheLength = 60
            };
            _widgetService.AddWidget(footerLinksWidgetForm);
        }