Beispiel #1
0
        protected void btnAddToCart_Click(object sender, EventArgs e)
        {
            if (Session["ClientOrderData"] == null)
            {
                clientData          = new ClientCartContext();
                clientData.CartInfo = new Cart();
            }
            else
            {
                clientData = (ClientCartContext)Session["ClientOrderData"];
                if (clientData.CartInfo == null)
                {
                    clientData.CartInfo = new CSBusiness.ShoppingManagement.Cart();
                    clientData.CartInfo.ShippingAddress = new CSBusiness.CustomerManagement.Address();
                }
            }
            bool showPopUP = false;

            if (Session["skuID_AddtoCart"] != null && Session["skuID_AddtoCart"].ToString() != "") // adding dynamic product to cart based on selected size of product
            {
                var id = Convert.ToInt32(Session["skuID_AddtoCart"].ToString());
                if (OrderHelper.AutoshipCart() && id == 120)
                {
                    showPopUP = true;
                }
                else
                {
                    clientData.CartInfo.AddItem(id, Convert.ToInt32(ddlQuantity.SelectedValue), true, false);
                }
            }
            else if (SkuId > 0)
            {
                clientData.CartInfo.AddItem(SkuId, Convert.ToInt32(ddlQuantity.SelectedValue), true, false);
            }
            else if (skuID > 0)
            {
                clientData.CartInfo.AddItem(skuID, Convert.ToInt32(ddlQuantity.SelectedValue), true, false);
            }



            //clientData.CartInfo.ShippingMethod = UserShippingMethodType.Rush;
            SiteBasePage.SetCatalogShipping();
            clientData.CartInfo.Compute();
            clientData.CartInfo.ShowQuantity = false;

            Session["ClientOrderData"] = clientData;

            if (showPopUP)
            {
                mpePopup.Show();
            }
            else
            {
                mpeMiniCart.Show();
                ucMiniCart.CallBindControl();
                //Response.Redirect("cart.aspx");
            }
        }