Example #1
0
        public void UpdateShoppingCart(string productCode, string quantity)
        {
            Assert.ArgumentNotNullOrEmpty(productCode, "productCode");
            Assert.ArgumentNotNullOrEmpty(quantity, "quantity");

            uint q;

            if (string.IsNullOrEmpty(quantity) || !uint.TryParse(quantity, out q))
            {
                return;
            }

            IShoppingCartManager shoppingCartManager = Sitecore.Ecommerce.Context.Entity.Resolve <IShoppingCartManager>();

            shoppingCartManager.UpdateProductQuantity(productCode, q);
            try
            {
                Tracker.StartTracking();
                AnalyticsUtil.ShoppingCartUpdated();
            }
            catch (Exception ex)
            {
                LogException(ex);
            }
        }
Example #2
0
        /// <summary>
        /// Handles the Click event of the btnUpdate control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        protected void btnUpdate_Click(object sender, EventArgs e)
        {
            AnalyticsUtil.ShoppingCartUpdated();

            this.UpdateShoppingCart();
        }