Esempio n. 1
0
        /// <summary>
        /// The update shopping cart.
        /// </summary>
        protected void UpdateShoppingCart()
        {
            foreach (var product in this.UcProductsListView.GetProducts())
            {
                string productCode = product.Key;
                uint   quant       = product.Value;

                ProductLine existingProductLine = this.Cart.ShoppingCartLines.FirstOrDefault(p => p.Product.Code.Equals(productCode));

                if (existingProductLine == null)
                {
                    return;
                }

                IShoppingCartManager shoppingCartManager = Sitecore.Ecommerce.Context.Entity.Resolve <IShoppingCartManager>();
                shoppingCartManager.UpdateProductQuantity(productCode, quant);

                AnalyticsUtil.ShoppingCartItemUpdated(productCode, existingProductLine.Product.Title, quant);
            }

            Sitecore.Ecommerce.Context.Entity.SetInstance(this.Cart);

            this.UpdateTotals(this.Cart);
            this.UpdateProductLines(this.Cart);
        }