示例#1
0
        public void Initialize(InitializationEngine context)
        {
            CatalogRouteHelper.MapDefaultHierarchialRouter(RouteTable.Routes, false);

            GlobalFilters.Filters.Add(new HandleErrorAttribute());
            GlobalFilters.Filters.Add(new ReadOnlyFilter());

            context.Locate.Advanced.GetInstance <IDisplayChannelService>().RegisterDisplayMode(new DefaultDisplayMode(RenderingTags.Mobile)
            {
                ContextCondition = r => r.GetOverriddenBrowser().IsMobileDevice
            });

            AreaRegistration.RegisterAllAreas();

#if DISABLE_PROMOTION_TYPES_FEATURE
            DisablePromotionTypes(context);
#endif

#if EXCLUDE_ITEMS_FROM_PROMOTION_ENGINE_FEATURE
            SetupExcludePromotionEntries(context);
#endif

#if ACTIVATE_DEFAULT_PERSONALIZATION_WIDGETS_FEATURE
            SetupPersonalizationsWidgets(context);
#endif
        }
        /// <summary>
        /// Configure default routing for EPiServer Commerce catalog content
        /// </summary>
        /// <remarks>
        /// TODO: If you want to remove the name of the catalog from the url, set the
        /// Catalog:RemoveCatalogFromUrl appSetting to true
        /// </remarks>
        /// <param name="routes"></param>
        private void MapCatalogRoute(RouteCollection routes)
        {
            string removeCatalogFromUrlSetting = System.Configuration.ConfigurationManager.AppSettings["Catalog:RemoveCatalogFromUrl"];
            bool   removeCatalogFromUrl        = false;

            bool.TryParse(removeCatalogFromUrlSetting, out removeCatalogFromUrl);
            if (removeCatalogFromUrl == false)
            {
                CatalogRouteHelper.MapDefaultHierarchialRouter(routes, false);
            }
            else
            {
                // This will pick the first catalog, and strip it from all urls (in and out)
                var contentLoader      = ServiceLocator.Current.GetInstance <IContentLoader>();
                var referenceConverter = ServiceLocator.Current.GetInstance <ReferenceConverter>();

                var firstCatalog =
                    contentLoader.GetChildren <CatalogContent>(referenceConverter.GetRootLink()).FirstOrDefault();

                var partialRouter2 = new HierarchicalCatalogPartialRouter(
                    () => SiteDefinition.Current.StartPage, firstCatalog, false);

                if (firstCatalog != null)
                {
                    routes.RegisterPartialRouter(partialRouter2);
                }
            }
        }
示例#3
0
        public void Initialize(InitializationEngine context)
        {
            CatalogRouteHelper.MapDefaultHierarchialRouter(RouteTable.Routes, false);

            GlobalFilters.Filters.Add(new HandleErrorAttribute());
            GlobalFilters.Filters.Add(new ReadOnlyFilter());

            context.Locate.Advanced.GetInstance <IDisplayChannelService>().RegisterDisplayMode(new DefaultDisplayMode(RenderingTags.Mobile)
            {
                ContextCondition = r => r.GetOverriddenBrowser().IsMobileDevice
            });

            AreaRegistration.RegisterAllAreas();

            DisablePromotionTypes(context);

            SetupExcludedPromotionEntries(context);

            //This method creates and activates the default Recommendations widgets.
            //It only needs to run once, not every initialization, and only if you use the Recommendations feature.
            //Instructions:
            //* Enter the configuration values for Recommendations in web.config
            //* Make sure that the episerver:RecommendationsSilentMode flag is not set to true.
            //* Uncomment the following line, compile, start site, commment the line again, compile.

            //SetupRecommendationsWidgets(context);
        }
 public static void Initialize(string applicationPath)
 {
     LoadAllAssembliesInFolder(applicationPath);
     SetupConfig();
     SetupHostingEnvironment(applicationPath);
     InitializationModule.FrameworkInitialization(HostType.TestFramework);
     SetupSiteDefinition();
     CatalogRouteHelper.MapDefaultHierarchialRouter(RouteTable.Routes, false);
 }
示例#5
0
        public void Initialize(InitializationEngine context)
        {
            CatalogRouteHelper.MapDefaultHierarchialRouter(RouteTable.Routes, false);

            GlobalFilters.Filters.Add(new HandleErrorAttribute());

            context.Locate.DisplayChannelService().RegisterDisplayMode(new DefaultDisplayMode(RenderingTags.Mobile)
            {
                ContextCondition = r => r.GetOverriddenBrowser().IsMobileDevice
            });

            AreaRegistration.RegisterAllAreas();
        }
示例#6
0
        public void Initialize(InitializationEngine context)
        {
            CatalogRouteHelper.MapDefaultHierarchialRouter(RouteTable.Routes, false);

            GlobalFilters.Filters.Add(new HandleErrorAttribute());
            GlobalFilters.Filters.Add(new ReadOnlyFilter());

            context.Locate.Advanced.GetInstance <IDisplayChannelService>().RegisterDisplayMode(new DefaultDisplayMode(RenderingTags.Mobile)
            {
                ContextCondition = r => r.GetOverriddenBrowser().IsMobileDevice
            });

            AreaRegistration.RegisterAllAreas();

            DisablePromotionTypes(context);

            SetupExcludedPromotionEntries(context);
        }
示例#7
0
        /// <summary>
        /// Configure default routing for EPiServer Commerce catalog content
        /// </summary>
        /// <remarks>
        /// TODO: If you want to remove the name of the catalog from the url, set the
        /// Catalog:RemoveCatalogFromUrl appSetting to true
        /// </remarks>
        /// <param name="routes"></param>
        private void MapCatalogRoute(RouteCollection routes)
        {
            string removeCatalogFromUrlSetting = System.Configuration.ConfigurationManager.AppSettings["Catalog:RemoveCatalogFromUrl"];
            bool   removeCatalogFromUrl        = false;

            bool.TryParse(removeCatalogFromUrlSetting, out removeCatalogFromUrl);
            if (removeCatalogFromUrl == false)
            {
                CatalogRouteHelper.MapDefaultHierarchialRouter(routes, false);
            }
            else
            {
                // This will pick the first catalog, and strip it from all urls (in and out)
                var contentLoader                  = ServiceLocator.Current.GetInstance <IContentLoader>();
                var referenceConverter             = ServiceLocator.Current.GetInstance <ReferenceConverter>();
                var languageSelectionFactory       = ServiceLocator.Current.GetInstance <LanguageSelectorFactory>();
                var routingSegmentLoader           = ServiceLocator.Current.GetInstance <IRoutingSegmentLoader>();
                var contentVersionRepo             = ServiceLocator.Current.GetInstance <IContentVersionRepository>();
                var urlSegmentRouter               = ServiceLocator.Current.GetInstance <IUrlSegmentRouter>();
                var contentLanguageSettingsHandler = ServiceLocator.Current.GetInstance <IContentLanguageSettingsHandler>();

                var firstCatalog =
                    contentLoader.GetChildren <CatalogContent>(referenceConverter.GetRootLink()).FirstOrDefault();

                var partialRouter = new HierarchicalCatalogPartialRouter(
                    () => SiteDefinition.Current.StartPage,
                    commerceRoot: firstCatalog,
                    supportSeoUri: false,
                    contentLoader: contentLoader,
                    languageSelectorFactory: languageSelectionFactory,
                    routingSegmentLoader: routingSegmentLoader,
                    contentVersionRepository: contentVersionRepo,
                    urlSegmentRouter: urlSegmentRouter,
                    contentLanguageSettingsHandler: contentLanguageSettingsHandler);

                var partialRouter2 = new HierarchicalCatalogPartialRouter(
                    () => SiteDefinition.Current.StartPage, firstCatalog, false);

                if (firstCatalog != null)
                {
                    routes.RegisterPartialRouter(partialRouter2);
                }
            }
        }
示例#8
0
 public void Initialize(InitializationEngine context)
 {
     CatalogRouteHelper.MapDefaultHierarchialRouter(RouteTable.Routes, false);
 }
        public void Initialize(InitializationEngine context)
        {
            // routing fund.
            //CatalogRouteHelper.MapDefaultHierarchialRouter(RouteTable.Routes,, false);

            // routing adv.
            CatalogRouteHelper.MapDefaultHierarchialRouter(RouteTable.Routes, () =>
            {
                // the scheduled job still have troubles
                var contentLoader = ServiceLocator.Current.GetInstance <IContentLoader>();

                // If epi-Find-error in exercise, it's the "catalog start"
                var startPage = new ContentReference(9);

                //var startPage = contentLoader.Get<PageData>(ContentReference.StartPage);
                if (startPage == null)                    // should maybe check for the "setting-prop"
                {
                    return(ContentReference.WasteBasket); //.StartPage;
                }

                //var homePage = startPage as StartPage;

                //return homePage != null ? homePage.Settings.catalogStartPageLink : ContentReference.StartPage;

                // if Find issues
                return(startPage);
            }
                                                           , false);

            #region Partial Routing Simplified... Conceptually
            //CatalogRouteHelper.MapDefaultHierarchialRouter(RouteTable.Routes, () =>
            //{
            //    var contentLoader = ServiceLocator.Current.GetInstance<IContentLoader>();
            //    var startPage = contentLoader.Get<StartPage>(ContentReference.StartPage);
            //    return startPage.Settings.catalogStartPageLink;
            //}
            //, false);
            #endregion

            #region Events CMS & ECF

            // Nice for Entry Pricing and Inventory updates
            CatalogKeyEventBroadcaster e =
                ServiceLocator.Current.GetInstance <CatalogKeyEventBroadcaster>();

            e.PriceUpdated     += e_PriceUpdated;
            e.InventoryUpdated += e_InventoryUpdated;

            Event.Get(CatalogEventBroadcaster.CommerceProductUpdated).Raised += EB;


            // this is the old one for Orders
            //OrderContext.Current.OrderGroupUpdated += Current_OrderGroupUpdated;

            // Good stuff for Orders ...\Infrastructure\CartAndCheckout\NewOrderEvents.cs
            //IOrderRepositoryCallback orc =
            //    ServiceLocator.Current.GetInstance<IOrderRepositoryCallback>();

            IContentEvents e2 = ServiceLocator.Current.GetInstance <IContentEvents>(); // ...the way to go
            e2.RequestedApproval += E2_RequestedApproval;
            e2.PublishedContent  += E2_PublishedContent;

            #endregion

            // new in 10.1.0
            SetPromotionExclusions(context);
        }
示例#10
0
 private static void MapRoutes(RouteCollection routes)
 {
     CatalogRouteHelper.MapDefaultHierarchialRouter(routes, false);
 }
 public void Initialize(InitializationEngine context)
 {
     CatalogRouteHelper.MapDefaultHierarchialRouter(RouteTable.Routes, false);
     EPiServer.Global.RoutesRegistered += Global_RoutesRegistered;
 }