Exemple #1
0
        /// <summary>
        /// Handles the Initialized event of the Bootstrapper.
        /// </summary>
        ///
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="ExecutedEventArgs"/> instance containing the event data.</param>
        protected static void OnBootstrapperInitialized(object sender, ExecutedEventArgs e)
        {
            // Register app-wide custom settings
            Config.RegisterSection <BabaganoushConfig>();

            //PERFORM LAST ACTIONS IN BOOTSTRAPPER
            if (e.CommandName != "Bootstrapped")
            {
                return;
            }
            //HANDLE ECOMMERCE IF APPLICABLE
            IModule ecommerceModule = SystemManager.GetModule(EcommerceModule.moduleName);

            if (ecommerceModule == null || ecommerceModule.Startup == StartupType.Disabled)
            {
                return;
            }
            //ENABLE CUSTOM FIELDS FOR ORDER CHECK OUT IF APPLICABLE
            if (!string.IsNullOrWhiteSpace(Config.Get <BabaganoushConfig>().Ecommerce.CustomCheckoutFields))
            {
                OrderHelper.CreateCustomFields();
                EventHub.Subscribe <IEcommerceCheckoutPageChangingEvent>(CheckoutHelper.PageChangingHandler);
            }

            //SUBSCRIBE TO ORDER PLACED HOOK FOR FURTHER PROCESSING
            EcommerceEvents.OrderPlaced += new EcommerceEvents.OnOrderPlaced(OrderHelper.CompletedHandler);

            //ENABLE SPECIAL PAYMENT PROCESSING
            if (Config.Get <BabaganoushConfig>().Ecommerce.DisableOnlinePaymentForFreeOrders)
            {
                ObjectFactory.Container.RegisterType <IEcommercePaymentMethodService, FreeOrdersMethodService>(new ContainerControlledLifetimeManager());
            }
        }