예제 #1
0
        public void Process(PipelineArgs args)
        {
            try
            {
                if (!PersistenceActive())
                {
                    return;
                }

                var restoreProductArgs = new RestoreCartArgs
                {
                    CartManager  = Sitecore.Ecommerce.Context.Entity.Resolve <IShoppingCartManager>(),
                    ShoppingCart =
                        Sitecore.Ecommerce.Context.Entity.GetInstance <ShoppingCart>() as
                        ActiveCommerce.Carts.ShoppingCart,
                    StockManager      = Sitecore.Ecommerce.Context.Entity.Resolve <IProductStockManager>(),
                    ProductRepository = Sitecore.Ecommerce.Context.Entity.Resolve <IProductRepository>(),
                    CustomerManager   = Sitecore.Ecommerce.Context.Entity.Resolve <ICustomerManager <CustomerInfo> >(),
                    Result            = new RestoreCartResult()
                };
                RestoreCartPipeline.Run(restoreProductArgs);
            }
            catch (Exception e)
            {
                Log.Error("Error loading shopping cart from persistent store", e, this);
            }
        }
예제 #2
0
        public override bool LogInCustomer(string nickName, string password)
        {
            var success = base.LogInCustomer(nickName, password);

            if (!CartPersistenceContext.IsActive)
            {
                return(success);
            }

            if (success)
            {
                var restoreProductArgs = new RestoreCartArgs
                {
                    ForceRestore      = true,
                    CartManager       = Sitecore.Ecommerce.Context.Entity.Resolve <IShoppingCartManager>(),
                    ShoppingCart      = Sitecore.Ecommerce.Context.Entity.GetInstance <ShoppingCart>() as ActiveCommerce.Carts.ShoppingCart,
                    StockManager      = Sitecore.Ecommerce.Context.Entity.Resolve <IProductStockManager>(),
                    ProductRepository = Sitecore.Ecommerce.Context.Entity.Resolve <IProductRepository>(),
                    CustomerManager   = Sitecore.Ecommerce.Context.Entity.Resolve <ICustomerManager <CustomerInfo> >(),
                    Result            = new RestoreCartResult()
                };
                RestoreCartPipeline.Run(restoreProductArgs);
                CartPersistenceContext.CartUpdated = true;
            }
            return(success);
        }