Beispiel #1
0
        /// <summary>
        /// Handles the Click event of the btnEmptyShoppingCart 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 btnEmptyShoppingCart_Click(object sender, EventArgs e)
        {
            uint       numberOfProducts    = 0;
            ListString shoppingCartContent = new ListString();

            foreach (ShoppingCartLine line in this.Cart.ShoppingCartLines)
            {
                shoppingCartContent.Add(line.Product.Code);
                numberOfProducts += line.Quantity;
            }

            AnalyticsUtil.ShoppingCartEmptied(shoppingCartContent.ToString(), numberOfProducts);

            this.Cart.ShoppingCartLines.Clear();

            ICheckOut checkOut = Sitecore.Ecommerce.Context.Entity.Resolve <ICheckOut>();

            if (checkOut is CheckOut)
            {
                ((CheckOut)checkOut).ResetCheckOut();
            }

            ItemUtil.RedirectToNavigationLink(ContinueShopping, false);
        }