Hi All,

When I login in my shoppingcart, the quantities are updates. 1 => 2, 2 => 4
How is this possible? I think it has something to do with customersession...
Anyone can help?

        public static bool Login(string Email, string Password)
        {
            Customer customer = GetByEmail(Email);
            if (customer == null)
                return false;
            if (!customer.Active)
                return false;
            if (customer.Deleted)
                return false;
            string passwordHash = CreatePasswordHash(Password, customer.SaltKey);
            bool result = customer.PasswordHash.Equals(passwordHash);
            if (result)
            {
                CustomerSession registeredCustomerSession = CustomerSessionManager.GetByCustomerID(customer.CustomerID);
                if (registeredCustomerSession != null)
                {
                    registeredCustomerSession.IsExpired = false;
                    CustomerSession anonCustomerSession = NopContext.Current.Session;
                    ShoppingCart cart1 = ShoppingCartManager.GetCurrentShoppingCart(ShoppingCartTypeEnum.ShoppingCart);
                    ShoppingCart cart2 = ShoppingCartManager.GetCurrentShoppingCart(ShoppingCartTypeEnum.Wishlist);
                    NopContext.Current.Session = registeredCustomerSession;
                    //UNDONE copy coupon code from NopContext.Current.LastAppliedCouponCode to Customer entity                    
                    if ((anonCustomerSession != null) && (anonCustomerSession.CustomerSessionGUID != registeredCustomerSession.CustomerSessionGUID))
                    {
                        foreach (ShoppingCartItem item in cart1)
                        {
                            ShoppingCartManager.AddToCart(item.ShoppingCartType, item.ProductVariantID, item.AttributeIDs, item.TextOption, item.Quantity);
                            ShoppingCartManager.DeleteShoppingCartItem(item.ShoppingCartItemID, true);
                        }
                        foreach (ShoppingCartItem item in cart2)
                        {
                            ShoppingCartManager.AddToCart(item.ShoppingCartType, item.ProductVariantID, item.AttributeIDs, item.TextOption, item.Quantity);
                            ShoppingCartManager.DeleteShoppingCartItem(item.ShoppingCartItemID, true);
                        }
                    }
                }
                if (NopContext.Current.Session == null)
                    NopContext.Current.Session = NopContext.Current.GetSession(true);
                NopContext.Current.Session.IsExpired = false;
                NopContext.Current.Session.LastAccessed = DateTime.Now;
                NopContext.Current.Session.CustomerID = customer.CustomerID;
                CustomerSessionManager.SaveCustomerSession(NopContext.Current.Session.CustomerSessionGUID, NopContext.Current.Session.CustomerID, NopContext.Current.Session.LastAccessed, NopContext.Current.Session.IsExpired);
            }
            return result;
        }