protected void Page_Load(object sender, EventArgs e) { selectShipping.IsLiveSite = IsLiveSite; selectPayment.IsLiveSite = IsLiveSite; if ((ShoppingCart != null) && (SiteContext.CurrentSite != null)) { if (ShoppingCart.CountryID == 0) { string countryName = ECommerceSettings.DefaultCountryName(SiteContext.CurrentSite.SiteName); CountryInfo ci = CountryInfoProvider.GetCountryInfo(countryName); ShoppingCart.CountryID = (ci != null) ? ci.CountryID : 0; } selectShipping.ShoppingCart = ShoppingCart; } if (IsShippingNeeded) { if (!ShoppingCartControl.IsCurrentStepPostBack) { SelectShippingOption(); } } else { // Don't use shipping selection selectShipping.StopProcessing = true; // Hide title headTitle.Visible = false; // Change current checkout process step caption ShoppingCartControl.CheckoutProcessSteps[ShoppingCartControl.CurrentStepIndex].Caption = GetString("order_new.paymentshipping.titlenoshipping"); } }
/// <summary> /// Checks default country for taxes calculation. /// </summary> private void CheckDefaultCountry() { if (DefaultCountryCheck) { string defaultCountry = ECommerceSettings.DefaultCountryName(CMSContext.CurrentSiteName); if (string.IsNullOrEmpty(defaultCountry)) { DisplayMessage("com.settingschecker.nodefaultcountry"); } } }
protected void Page_Load(object sender, EventArgs e) { this.lblTitle.Text = this.GetString("shoppingcart.shippingpaymentoptions"); this.lblPayment.Text = this.GetString("shoppingcartpaymentshipping.payment"); this.lblShipping.Text = this.GetString("shoppingcartpaymentshipping.shipping"); this.selectShipping.IsLiveSite = this.IsLiveSite; this.selectPayment.IsLiveSite = this.IsLiveSite; this.selectPayment.DisplayOnlyAllowedIfNoShipping = !this.IsShippingNeeded; if ((ShoppingCartInfoObj != null) && (CMSContext.CurrentSite != null)) { if (ShoppingCartInfoObj.CountryID == 0) { string countryName = ECommerceSettings.DefaultCountryName(CMSContext.CurrentSite.SiteName); CountryInfo ci = CountryInfoProvider.GetCountryInfo(countryName); ShoppingCartInfoObj.CountryID = (ci != null) ? ci.CountryID : 0; } selectShipping.ShoppingCart = ShoppingCartInfoObj; } if (!this.ShoppingCartControl.IsCurrentStepPostBack) { if (this.IsShippingNeeded) { this.SelectShippingOption(); } else { // Don't use shipping selection this.selectShipping.StopProcessing = true; // Hide title this.lblTitle.Visible = false; // Change current checkout process step caption this.ShoppingCartControl.CheckoutProcessSteps[this.ShoppingCartControl.CurrentStepIndex].Caption = this.GetString("order_new.paymentshipping.titlenoshipping"); } } }
/// <summary> /// Clean specified part of the form. /// </summary> private void CleanForm(bool billing, bool shipping, bool company) { int defaultCountryId = 0; int defaultStateId = 0; // Prefill country from customer if any if ((ShoppingCart != null) && (ShoppingCart.Customer != null)) { defaultCountryId = ShoppingCart.Customer.CustomerCountryID; defaultStateId = ShoppingCart.Customer.CustomerStateID; } // Prefill default store country if customers country not found if ((defaultCountryId <= 0) && (SiteContext.CurrentSite != null)) { string countryName = ECommerceSettings.DefaultCountryName(SiteContext.CurrentSite.SiteName); CountryInfo ci = CountryInfoProvider.GetCountryInfo(countryName); defaultCountryId = (ci != null) ? ci.CountryID : 0; defaultStateId = 0; } }
protected void Page_Load(object sender, EventArgs e) { currentSite = CMSContext.CurrentSite; this.lblTitle.Text = GetString("ShoppingCartPreview.Title"); if ((ShoppingCartInfoObj != null) && (ShoppingCartInfoObj.CountryID == 0) && (currentSite != null)) { string countryName = ECommerceSettings.DefaultCountryName(currentSite.SiteName); CountryInfo ci = CountryInfoProvider.GetCountryInfo(countryName); ShoppingCartInfoObj.CountryID = (ci != null) ? ci.CountryID : 0; } this.ShoppingCartControl.ButtonNext.Text = GetString("Ecommerce.OrderPreview.NextButtonText"); // addresses initialization pnlBillingAddress.GroupingText = GetString("Ecommerce.CartPreview.BillingAddressPanel"); pnlShippingAddress.GroupingText = GetString("Ecommerce.CartPreview.ShippingAddressPanel"); pnlCompanyAddress.GroupingText = GetString("Ecommerce.CartPreview.CompanyAddressPanel"); FillBillingAddressForm(ShoppingCartInfoObj.ShoppingCartBillingAddressID); FillShippingAddressForm(ShoppingCartInfoObj.ShoppingCartShippingAddressID); // Load company address if (ShoppingCartInfoObj.ShoppingCartCompanyAddressID > 0) { lblCompany.Text = OrderInfoProvider.GetAddress(ShoppingCartInfoObj.ShoppingCartCompanyAddressID); mAddressCount++; tdCompanyAddress.Visible = true; } else { tdCompanyAddress.Visible = false; } // Enable sending order notifications when creating order from CMSDesk if ((this.ShoppingCartControl.CheckoutProcessType == CheckoutProcessEnum.CMSDeskOrder) || this.ShoppingCartControl.CheckoutProcessType == CheckoutProcessEnum.CMSDeskCustomer) { chkSendEmail.Visible = true; chkSendEmail.Checked = ECommerceSettings.SendOrderNotification(currentSite.SiteName); chkSendEmail.Text = GetString("ShoppingCartPreview.SendNotification"); } // Show tax registration ID and organization ID InitializeIDs(); // shopping cart content table initialization gridData.Columns[4].HeaderText = GetString("Ecommerce.ShoppingCartContent.SKUName"); gridData.Columns[5].HeaderText = GetString("Ecommerce.ShoppingCartContent.SKUUnits"); gridData.Columns[6].HeaderText = GetString("Ecommerce.ShoppingCartContent.UnitPrice"); gridData.Columns[7].HeaderText = GetString("Ecommerce.ShoppingCartContent.UnitDiscount"); gridData.Columns[8].HeaderText = GetString("Ecommerce.ShoppingCartContent.Tax"); gridData.Columns[9].HeaderText = GetString("Ecommerce.ShoppingCartContent.Subtotal"); // Product tax summary table initialiazation gridTaxSummary.Columns[0].HeaderText = GetString("Ecommerce.CartContent.TaxDisplayName"); gridTaxSummary.Columns[1].HeaderText = GetString("Ecommerce.CartContent.TaxSummary"); // Shipping tax summary table initialiazation gridShippingTaxSummary.Columns[0].HeaderText = GetString("com.CartContent.ShippingTaxDisplayName"); gridShippingTaxSummary.Columns[1].HeaderText = GetString("Ecommerce.CartContent.TaxSummary"); ReloadData(); // order note initialization lblNote.Text = GetString("ecommerce.cartcontent.notelabel"); if (!this.ShoppingCartControl.IsCurrentStepPostBack) { // Try to select payment from ViewState first object viewStateValue = this.ShoppingCartControl.GetTempValue(ORDER_NOTE); if (viewStateValue != null) { this.txtNote.Text = Convert.ToString(viewStateValue); } else { this.txtNote.Text = ShoppingCartInfoObj.ShoppingCartNote; } } // Display/Hide column with applied discount gridData.Columns[7].Visible = this.ShoppingCartInfoObj.IsDiscountApplied; if (mAddressCount == 2) { tblAddressPreview.Attributes["class"] = "AddressPreviewWithTwoColumns"; } else if (mAddressCount == 3) { tblAddressPreview.Attributes["class"] = "AddressPreviewWithThreeColumns"; } }
/// <summary> /// Page load. /// </summary> protected void Page_Load(object sender, EventArgs e) { this.lblTitle.Text = GetString("ShoppingCart.CartContent"); //bool currencySelected = false; if ((ShoppingCartInfoObj != null) && (ShoppingCartInfoObj.CountryID == 0) && (CMSContext.CurrentSite != null)) { string countryName = ECommerceSettings.DefaultCountryName(CMSContext.CurrentSite.SiteName); CountryInfo ci = CountryInfoProvider.GetCountryInfo(countryName); ShoppingCartInfoObj.CountryID = (ci != null) ? ci.CountryID : 0; // Set currency selectors site ID selectCurrency.SiteID = this.ShoppingCartInfoObj.ShoppingCartSiteID; } // Initialization imgNewItem.ImageUrl = GetImageUrl("Objects/Ecommerce_OrderItem/add.png"); lblCurrency.Text = GetString("Ecommerce.ShoppingCartContent.Currency"); lblCoupon.Text = GetString("Ecommerce.ShoppingCartContent.Coupon"); lnkNewItem.Text = GetString("Ecommerce.ShoppingCartContent.AddItem"); imgNewItem.AlternateText = lnkNewItem.Text; btnUpdate.Text = GetString("Ecommerce.ShoppingCartContent.BtnUpdate"); btnEmpty.Text = GetString("Ecommerce.ShoppingCartContent.BtnEmpty"); btnEmpty.OnClientClick = "return confirm(" + ScriptHelper.GetString(GetString("Ecommerce.ShoppingCartContent.EmptyConfirm")) + ");"; //this.TitleText = GetString("order_new.cartcontent.title"); lnkNewItem.OnClientClick = "OpenAddProductDialog('" + GetCMSDeskShoppingCartSessionName() + "');return false;"; gridData.Columns[4].HeaderText = GetString("general.remove"); gridData.Columns[5].HeaderText = GetString("Ecommerce.ShoppingCartContent.SKUName"); gridData.Columns[6].HeaderText = GetString("Ecommerce.ShoppingCartContent.SKUUnits"); gridData.Columns[7].HeaderText = GetString("Ecommerce.ShoppingCartContent.UnitPrice"); gridData.Columns[8].HeaderText = GetString("Ecommerce.ShoppingCartContent.UnitDiscount"); gridData.Columns[9].HeaderText = GetString("Ecommerce.ShoppingCartContent.Tax"); gridData.Columns[10].HeaderText = GetString("Ecommerce.ShoppingCartContent.Subtotal"); this.gridData.RowDataBound += new GridViewRowEventHandler(gridData_RowDataBound); // Registre product price detail javascript StringBuilder script = new StringBuilder(); script.Append("function ShowProductPriceDetail(cartItemGuid, sessionName){"); script.Append("if (sessionName != \"\"){sessionName = \"&cart=\" + sessionName;}"); string detailUrl = "~/CMSModules/Ecommerce/Controls/ShoppingCart/ShoppingCartSKUPriceDetail.aspx"; if (this.IsLiveSite) { detailUrl = "~/CMSModules/Ecommerce/CMSPages/ShoppingCartSKUPriceDetail.aspx"; } script.Append("modalDialog('" + ResolveUrl(detailUrl) + "?itemguid=' + cartItemGuid + sessionName, 'ProductPriceDetail', 750, 500);}"); ScriptHelper.RegisterClientScriptBlock(this, typeof(string), "ProductPriceDetail", ScriptHelper.GetScript(script.ToString())); script = new StringBuilder(); script.Append("function OpenOrderItemDialog(cartItemGuid, sessionName){"); script.Append("if (sessionName != \"\"){sessionName = \"&cart=\" + sessionName;}"); script.Append("modalDialog('" + ResolveUrl("~/CMSModules/Ecommerce/Controls/ShoppingCart/OrderItemEdit.aspx") + "?itemguid=' + cartItemGuid + sessionName, 'OrderItemEdit', 500, 350);}"); ScriptHelper.RegisterClientScriptBlock(this, typeof(string), "OrderItemEdit", ScriptHelper.GetScript(script.ToString())); // Hide "add product" link if it is live site order if (!this.ShoppingCartControl.IsInternalOrder) { pnlNewItem.Visible = false; this.ShoppingCartControl.ButtonBack.Text = GetString("Ecommerce.CartContent.ButtonBackText"); this.ShoppingCartControl.ButtonBack.CssClass = "LongButton"; this.ShoppingCartControl.ButtonNext.Text = GetString("Ecommerce.CartContent.ButtonNextText"); if (!this.ShoppingCartControl.IsCurrentStepPostBack) { // Get shopping cart item parameters from URL ShoppingCartItemParameters itemParams = ShoppingCartItemParameters.GetShoppingCartItemParameters(); // Set item in the shopping cart AddProducts(itemParams); } } // Set sending order notification when editing existing order according to the site settings if (this.ShoppingCartControl.CheckoutProcessType == CheckoutProcessEnum.CMSDeskOrderItems) { if (!this.ShoppingCartControl.IsCurrentStepPostBack) { SiteInfo si = SiteInfoProvider.GetSiteInfo(this.ShoppingCartInfoObj.ShoppingCartSiteID); if (si != null) { chkSendEmail.Checked = ECommerceSettings.SendOrderNotification(si.SiteName); } } chkSendEmail.Visible = true; chkSendEmail.Text = GetString("ShoppingCartContent.SendEmail"); } if (this.ShoppingCartControl.CheckoutProcessType == CheckoutProcessEnum.CMSDeskOrderItems) { this.ShoppingCartControl.ButtonBack.Visible = false; this.ShoppingCartInfoObj.CheckAvailableItems = false; if ((!ExistAnotherStepsExceptPayment) && (this.ShoppingCartControl.PaymentGatewayProvider == null)) { this.ShoppingCartControl.ButtonNext.Text = GetString("General.OK"); } else { this.ShoppingCartControl.ButtonNext.Text = GetString("general.next"); } } // Fill dropdownlist if (!this.ShoppingCartControl.IsCurrentStepPostBack) { if ((this.ShoppingCartInfoObj.CartItems.Count > 0) || this.ShoppingCartControl.IsInternalOrder) { if (this.ShoppingCartInfoObj != null) { if (ShoppingCartInfoObj.ShoppingCartCurrencyID == 0) { // Select customer preferred currency if (ShoppingCartInfoObj.CustomerInfoObj != null) { CustomerInfo customer = ShoppingCartInfoObj.CustomerInfoObj; ShoppingCartInfoObj.ShoppingCartCurrencyID = (customer.CustomerUser != null) ? customer.CustomerUser.GetUserPreferredCurrencyID(CMSContext.CurrentSiteName) : 0; } } if (ShoppingCartInfoObj.ShoppingCartCurrencyID == 0) { if (CMSContext.CurrentSite != null) { ShoppingCartInfoObj.ShoppingCartCurrencyID = CMSContext.CurrentSite.SiteDefaultCurrencyID; } } selectCurrency.CurrencyID = ShoppingCartInfoObj.ShoppingCartCurrencyID; if (ShoppingCartInfoObj.ShoppingCartDiscountCouponID > 0) { // fill textbox with discount coupon code DiscountCouponInfo dci = DiscountCouponInfoProvider.GetDiscountCouponInfo(ShoppingCartInfoObj.ShoppingCartDiscountCouponID); if (dci != null) { if (this.ShoppingCartInfoObj.IsCreatedFromOrder || dci.IsValid) { txtCoupon.Text = dci.DiscountCouponCode; } else { this.ShoppingCartInfoObj.ShoppingCartDiscountCouponID = 0; } } } } } ReloadData(); } // Turn on available items checking after content is loaded ShoppingCartInfoObj.CheckAvailableItems = true; }
protected void Page_Load(object sender, EventArgs e) { EventLogProvider p = new EventLogProvider(); // Init labels lblTitle.Text = GetString("shoppingcart.shippingpaymentoptions"); lblPayment.Text = GetString("shoppingcartpaymentshipping.payment"); lblShipping.Text = GetString("shoppingcartpaymentshipping.shipping"); selectShipping.IsLiveSite = IsLiveSite; selectPayment.IsLiveSite = IsLiveSite; if ((ShoppingCart != null) && (SiteContext.CurrentSite != null)) { if (ShoppingCart.CountryID == 0) { string countryName = ECommerceSettings.DefaultCountryName(SiteContext.CurrentSite.SiteName); CountryInfo ci = CountryInfoProvider.GetCountryInfo(countryName); ShoppingCart.CountryID = (ci != null) ? ci.CountryID : 0; } selectShipping.ShoppingCart = ShoppingCart; } if (!ShoppingCartControl.IsCurrentStepPostBack) { if (IsShippingNeeded) { p.LogEvent("I", DateTime.Now, "SHIPPING NEED TRUE", ""); SelectShippingOption(); } else { p.LogEvent("I", DateTime.Now, "SHIPPING NEED FALSE", ""); // Don't use shipping selection selectShipping.StopProcessing = true; // Hide title lblTitle.Visible = false; // Change current checkout process step caption ShoppingCartControl.CheckoutProcessSteps[ShoppingCartControl.CurrentStepIndex].Caption = GetString("order_new.paymentshipping.titlenoshipping"); } } AddressInfo aiBill = AddressInfoProvider.GetAddressInfo(ShoppingCart.ShoppingCartBillingAddressID); AddressInfo aiShip = AddressInfoProvider.GetAddressInfo(ShoppingCart.ShoppingCartShippingAddressID); if (aiBill != null && aiShip != null) { addressData.Text = string.Format("<h1> ADDRESS DATA </h1> <br/>{0} - {1} <br/> {2} - {3}", aiBill.AddressID.ToString(), aiBill.AddressCity, aiShip.AddressID.ToString(), aiShip.AddressCity); } else { if (aiBill == null) { addressData.Text = "AIBILL NULL"; } if (aiShip == null) { addressData.Text = string.Format("{0} AISHIP NULL", addressData.Text); } } // bind drop ddlShippingOption DataSet ds, dsoi = null; double vat = ShippingExtendedInfoProvider.GetCartShippingVatRate(ShoppingCart); p.LogEvent("I", DateTime.Now, "TVA du BO : " + vat, "code B.O"); if (vat > 0) { vat = 1.06; } else { vat = 1; } p.LogEvent("I", DateTime.Now, "ShoppingCart.ShoppingCartShippingAddressID : " + ShoppingCart.ShoppingCartShippingAddressID, "code B.O"); var addrezz = AddressInfoProvider.GetAddressInfo(ShoppingCart.ShoppingCartShippingAddressID); if (addrezz != null) { var newCountryId = addrezz.AddressCountryID; QueryDataParameters parameters = new QueryDataParameters(); ShippingUnit = ShippingExtendedInfoProvider.GetCartShippingUnit(ShoppingCart); p.LogEvent("I", DateTime.Now, "shipping du B.O : " + ShippingUnit, "code B.O"); parameters.Add("@ShippingUnits", ShippingUnit); parameters.Add("@CountryID", newCountryId); parameters.Add("@VATRate", vat); //parameters.Add("@VATRate", 1 + ShippingExtendedInfoProvider.GetCartShippingVatRate(ShoppingCart) / 100); GeneralConnection cn = ConnectionHelper.GetConnection(); ds = cn.ExecuteQuery("customtable.shippingextension.ShippingCostListByCountry", parameters); if (!DataHelper.DataSourceIsEmpty(ds)) { DataTable dt = ds.Tables[0]; foreach (DataRow drow in dt.Rows) { double price = Convert.ToDouble(drow["ShippingFinalCost"]); string prices = CurrencyInfoProvider.GetFormattedPrice(price, ShoppingCart.Currency); drow["DisplayString"] = string.Format("{0}- {1}", drow["ShippingOptionDisplayName"].ToString(), prices); } ddlShippingOption.DataSource = ds; ddlShippingOption.SelectedIndex = -1; ddlShippingOption.SelectedValue = null; ddlShippingOption.ClearSelection(); ddlShippingOption.DataTextField = "DisplayString"; ddlShippingOption.DataValueField = "ItemID"; ddlShippingOption.DataBind(); ddlShippingOption.AutoPostBack = (ddlShippingOption.Items.Count > 1); // string value = ValidationHelper.GetString(SessionHelper.GetValue("CarriedOnPriceID"), string.Empty); string value = ValidationHelper.GetString(ShippingExtendedInfoProvider.GetCustomFieldValue(ShoppingCart, "ShoppingCartCarriedOnPriceID"), string.Empty); if (!string.IsNullOrEmpty(value) && ddlShippingOption.Items.Count > 1) { if (int.Parse(value) > 0) { // SessionHelper.SetValue("CarriedOnPriceID", string.Empty); ShippingExtendedInfoProvider.SetCustomFieldValue(ShoppingCart, "ShoppingCartCarriedOnPriceID", -1); try { ddlShippingOption.SelectedValue = value; } catch { } } } //int PriceID = ValidationHelper.GetInteger(ddlShippingOption.SelectedValue, -1); //SessionHelper.SetValue("PriceID", PriceID); // SessionHelper.SetValue("CountryID", ai.AddressCountryID); ShippingExtendedInfoProvider.SetCustomFieldValue(ShoppingCart, "ShoppingCartCountryID", newCountryId); ddlShippingOption_SelectedIndexChanged(null, null); //btnUpdate_Click1(null, null); } else { // NO SHIPPING AVAILABLE ddlShippingOption.Items.Clear(); ddlShippingOption.DataSource = null; ListItem listItem = new ListItem("Votre choix", "-1"); ddlShippingOption.Items.Add(listItem); } } // bind drop ddlPaymentOption string where = "PaymentOptionEnabled=1 AND PaymentOptionID != 9"; string orderby = "PaymentOptionName"; //DataSet ds = PaymentOptionInfoProvider.GetPaymentOptions(CurrentSite.SiteID, true); DataSet ds2 = PaymentOptionInfoProvider.GetPaymentOptions(where, orderby); if (!DataHelper.DataSourceIsEmpty(ds2)) { ddlPaymentOption.DataSource = ds2; ddlPaymentOption.DataTextField = "PaymentOptionDisplayName"; ddlPaymentOption.DataValueField = "PaymentOptionId"; ddlPaymentOption.DataBind(); // string value = ValidationHelper.GetString(SessionHelper.GetValue("PaymentID"), string.Empty); string value = ValidationHelper.GetString(ShippingExtendedInfoProvider.GetCustomFieldValue(ShoppingCart, "ShoppingCartPaymentID"), string.Empty); if (!string.IsNullOrEmpty(value)) { ddlPaymentOption.SelectedValue = value; } ddlPaymentOption_SelectedIndexChanged(null, null); } }
protected override void OnLoad(EventArgs e) { // Show message when reordering and not all reordered product were added to cart if (!URLHelper.IsPostback() && QueryHelper.GetBoolean("notallreordered", false)) { lblError.Text = GetString("com.notallreordered"); } if ((ShoppingCart != null) && IsLiveSite) { // Get order information OrderInfo oi = OrderInfoProvider.GetOrderInfo(ShoppingCart.OrderId); // If order is paid if ((oi != null) && (oi.OrderIsPaid)) { // Clean shopping cart if paid order cart is still in customers current cart on LS ShoppingCartControl.CleanUpShoppingCart(); } } if ((ShoppingCart != null) && (ShoppingCart.CountryID == 0) && (SiteContext.CurrentSite != null)) { string countryName = ECommerceSettings.DefaultCountryName(SiteContext.CurrentSiteName); CountryInfo ci = CountryInfoProvider.GetCountryInfo(countryName); ShoppingCart.CountryID = (ci != null) ? ci.CountryID : 0; // Set currency selectors site ID selectCurrency.SiteID = ShoppingCart.ShoppingCartSiteID; } lnkNewItem.Text = GetString("ecommerce.shoppingcartcontent.additem"); btnUpdate.Text = GetString("ecommerce.shoppingcartcontent.btnupdate"); btnEmpty.Text = GetString("ecommerce.shoppingcartcontent.btnempty"); btnEmpty.OnClientClick = string.Format("return confirm({0});", ScriptHelper.GetString(GetString("ecommerce.shoppingcartcontent.emptyconfirm"))); // Add new product dialog string addProductUrl = ApplicationUrlHelper.GetElementDialogUrl(ModuleName.ECOMMERCE, "order.addorderitems", 0, GetCMSDeskShoppingCartSessionNameQuery()); lnkNewItem.OnClientClick = ScriptHelper.GetModalDialogScript(addProductUrl, "addproduct", 1000, 620); gridData.Columns[4].HeaderText = GetString("general.remove"); gridData.Columns[5].HeaderText = GetString("ecommerce.shoppingcartcontent.actions"); gridData.Columns[6].HeaderText = GetString("ecommerce.shoppingcartcontent.skuname"); gridData.Columns[7].HeaderText = GetString("ecommerce.shoppingcartcontent.skuunits"); gridData.Columns[8].HeaderText = GetString("ecommerce.shoppingcartcontent.unitprice"); gridData.Columns[9].HeaderText = GetString("ecommerce.shoppingcartcontent.unitdiscount"); gridData.Columns[10].HeaderText = GetString("ecommerce.shoppingcartcontent.tax"); gridData.Columns[11].HeaderText = GetString("ecommerce.shoppingcartcontent.subtotal"); gridData.RowDataBound += gridData_RowDataBound; // Hide "add product" action for live site order if (!ShoppingCartControl.IsInternalOrder) { pnlNewItem.Visible = false; ShoppingCartControl.ButtonBack.Text = GetString("ecommerce.cartcontent.buttonbacktext"); ShoppingCartControl.ButtonBack.ButtonStyle = ButtonStyle.Default; ShoppingCartControl.ButtonNext.Text = GetString("ecommerce.cartcontent.buttonnexttext"); if (!ShoppingCartControl.IsCurrentStepPostBack) { // Get shopping cart item parameters from URL ShoppingCartItemParameters itemParams = ShoppingCartItemParameters.GetShoppingCartItemParameters(); // Set item in the shopping cart AddProducts(itemParams); } } // Set sending order notification when editing existing order according to the site settings if (ShoppingCartControl.CheckoutProcessType == CheckoutProcessEnum.CMSDeskOrderItems) { if (!ShoppingCartControl.IsCurrentStepPostBack) { if (!string.IsNullOrEmpty(ShoppingCart.SiteName)) { chkSendEmail.Checked = ECommerceSettings.SendOrderNotification(ShoppingCart.SiteName); } } // Show send email checkbox chkSendEmail.Visible = true; chkSendEmail.Text = GetString("shoppingcartcontent.sendemail"); // Setup buttons ShoppingCartControl.ButtonBack.Visible = false; ShoppingCart.CheckAvailableItems = false; ShoppingCartControl.ButtonNext.Text = GetString("general.next"); if ((!ExistAnotherStepsExceptPayment) && (ShoppingCartControl.PaymentGatewayProvider == null)) { ShoppingCartControl.ButtonNext.Text = GetString("general.ok"); } } // Fill dropdownlist if (!ShoppingCartControl.IsCurrentStepPostBack) { if (!ShoppingCart.IsEmpty || ShoppingCartControl.IsInternalOrder) { selectCurrency.SelectedID = ShoppingCart.ShoppingCartCurrencyID; // Fill textbox with discount coupon code if (!String.IsNullOrEmpty(ShoppingCart.ShoppingCartCouponCode)) { txtCoupon.Text = ShoppingCart.ShoppingCartCouponCode; } } ReloadData(); } // Ensure order currency in selector if ((ShoppingCartControl.CheckoutProcessType == CheckoutProcessEnum.CMSDeskOrderItems) && (ShoppingCart.Order != null)) { selectCurrency.AdditionalItems += ShoppingCart.Order.OrderCurrencyID + ";"; } // Turn on available items checking after content is loaded ShoppingCart.CheckAvailableItems = true; base.OnLoad(e); }
/// <summary> /// Clean specified part of the form. /// </summary> private void CleanForm(bool billing, bool shipping, bool company) { var defaultCountryId = 0; var defaultStateId = 0; // Prefill country from customer if any if ((ShoppingCart != null) && (ShoppingCart.Customer != null)) { defaultCountryId = ShoppingCart.Customer.CustomerCountryID; defaultStateId = ShoppingCart.Customer.CustomerStateID; } // Prefill default store country if customers country not found if ((defaultCountryId <= 0) && (SiteContext.CurrentSite != null)) { var countryName = ECommerceSettings.DefaultCountryName(SiteContext.CurrentSite.SiteName); var ci = CountryInfoProvider.GetCountryInfo(countryName); defaultCountryId = (ci != null) ? ci.CountryID : 0; defaultStateId = 0; } if (shipping) { txtShippingName.Text = ""; txtShippingAddr1.Text = ""; txtShippingAddr2.Text = ""; txtShippingCity.Text = ""; txtShippingZip.Text = ""; txtShippingPhone.Text = ""; // Pre-load default country CountrySelector2.CountryID = defaultCountryId; CountrySelector2.StateID = defaultStateId; CountrySelector2.ReloadData(true); } if (billing) { txtBillingName.Text = ""; txtBillingAddr1.Text = ""; txtBillingAddr2.Text = ""; txtBillingCity.Text = ""; txtBillingZip.Text = ""; txtBillingPhone.Text = ""; // Pre-load default country CountrySelector1.CountryID = defaultCountryId; CountrySelector1.StateID = defaultStateId; CountrySelector1.ReloadData(true); } if (company) { txtCompanyName.Text = ""; txtCompanyLine1.Text = ""; txtCompanyLine2.Text = ""; txtCompanyCity.Text = ""; txtCompanyZip.Text = ""; txtCompanyPhone.Text = ""; // Pre-load default country CountrySelector3.CountryID = defaultCountryId; CountrySelector3.StateID = defaultStateId; CountrySelector3.ReloadData(true); } }
protected override void OnLoad(EventArgs e) { lblTitle.Text = GetString("shoppingcart.cartcontent"); if ((ShoppingCart != null) && (ShoppingCart.CountryID == 0) && (SiteContext.CurrentSite != null)) { string countryName = ECommerceSettings.DefaultCountryName(SiteContext.CurrentSite.SiteName); CountryInfo ci = CountryInfoProvider.GetCountryInfo(countryName); ShoppingCart.CountryID = (ci != null) ? ci.CountryID : 0; // Set currency selectors site ID selectCurrency.SiteID = ShoppingCart.ShoppingCartSiteID; } imgNewItem.ImageUrl = GetImageUrl("Objects/Ecommerce_OrderItem/add.png"); lblCurrency.Text = GetString("ecommerce.shoppingcartcontent.currency"); lblCoupon.Text = GetString("ecommerce.shoppingcartcontent.coupon"); lnkNewItem.Text = GetString("ecommerce.shoppingcartcontent.additem"); imgNewItem.AlternateText = lnkNewItem.Text; btnUpdate.Text = GetString("ecommerce.shoppingcartcontent.btnupdate"); btnEmpty.Text = GetString("ecommerce.shoppingcartcontent.btnempty"); btnEmpty.OnClientClick = string.Format("return confirm({0});", ScriptHelper.GetString(GetString("ecommerce.shoppingcartcontent.emptyconfirm"))); lnkNewItem.OnClientClick = string.Format("OpenAddProductDialog('{0}');return false;", GetCMSDeskShoppingCartSessionName()); gridData.Columns[4].HeaderText = GetString("general.remove"); gridData.Columns[5].HeaderText = GetString("ecommerce.shoppingcartcontent.actions"); gridData.Columns[6].HeaderText = GetString("ecommerce.shoppingcartcontent.skuname"); gridData.Columns[7].HeaderText = GetString("ecommerce.shoppingcartcontent.skuunits"); gridData.Columns[8].HeaderText = GetString("ecommerce.shoppingcartcontent.unitprice"); gridData.Columns[9].HeaderText = GetString("ecommerce.shoppingcartcontent.unitdiscount"); gridData.Columns[10].HeaderText = GetString("ecommerce.shoppingcartcontent.tax"); gridData.Columns[11].HeaderText = GetString("ecommerce.shoppingcartcontent.subtotal"); gridData.RowDataBound += new GridViewRowEventHandler(gridData_RowDataBound); // Register product price detail dialog script StringBuilder script = new StringBuilder(); script.Append("function ShowProductPriceDetail(cartItemGuid, sessionName) {"); script.Append("if (sessionName != \"\"){sessionName = \"&cart=\" + sessionName;}"); string detailUrl = (IsLiveSite) ? "~/CMSModules/Ecommerce/CMSPages/ShoppingCartSKUPriceDetail.aspx" : "~/CMSModules/Ecommerce/Controls/ShoppingCart/ShoppingCartSKUPriceDetail.aspx"; script.Append(string.Format("modalDialog('{0}?itemguid=' + cartItemGuid + sessionName, 'ProductPriceDetail', 750, 500); }}", ResolveUrl(detailUrl))); ScriptHelper.RegisterClientScriptBlock(this, typeof(string), "ProductPriceDetail", ScriptHelper.GetScript(script.ToString())); // Register add order item dialog script script = new StringBuilder(); script.Append("function OpenOrderItemDialog(cartItemGuid, sessionName) {"); script.Append("if (sessionName != \"\"){sessionName = \"&cart=\" + sessionName;}"); script.Append(string.Format("modalDialog('{0}?itemguid=' + cartItemGuid + sessionName, 'OrderItemEdit', 500, 350); }}", ResolveUrl("~/CMSModules/Ecommerce/Controls/ShoppingCart/OrderItemEdit.aspx"))); ScriptHelper.RegisterClientScriptBlock(this, typeof(string), "OrderItemEdit", ScriptHelper.GetScript(script.ToString())); script = new StringBuilder(); string addProductUrl = AuthenticationHelper.ResolveDialogUrl("~/CMSModules/Ecommerce/Pages/Tools/Orders/Order_Edit_AddItems.aspx"); script.AppendFormat("var addProductDialogURL = '{0}'", URLHelper.GetAbsoluteUrl(addProductUrl)); ScriptHelper.RegisterClientScriptBlock(this, typeof(string), "AddProduct", ScriptHelper.GetScript(script.ToString())); // Hide "add product" action for live site order if (!ShoppingCartControl.IsInternalOrder) { pnlNewItem.Visible = false; ShoppingCartControl.ButtonBack.Text = GetString("ecommerce.cartcontent.buttonbacktext"); ShoppingCartControl.ButtonBack.CssClass = "LongButton"; ShoppingCartControl.ButtonNext.Text = GetString("ecommerce.cartcontent.buttonnexttext"); if (!ShoppingCartControl.IsCurrentStepPostBack) { // Get shopping cart item parameters from URL ShoppingCartItemParameters itemParams = ShoppingCartItemParameters.GetShoppingCartItemParameters(); // Set item in the shopping cart AddProducts(itemParams); } } // Set sending order notification when editing existing order according to the site settings if (ShoppingCartControl.CheckoutProcessType == CheckoutProcessEnum.CMSDeskOrderItems) { if (!ShoppingCartControl.IsCurrentStepPostBack) { if (!string.IsNullOrEmpty(ShoppingCart.SiteName)) { chkSendEmail.Checked = ECommerceSettings.SendOrderNotification(ShoppingCart.SiteName); } } // Show send email checkbox chkSendEmail.Visible = true; chkSendEmail.Text = GetString("shoppingcartcontent.sendemail"); // Setup buttons ShoppingCartControl.ButtonBack.Visible = false; ShoppingCart.CheckAvailableItems = false; ShoppingCartControl.ButtonNext.Text = GetString("general.next"); if ((!ExistAnotherStepsExceptPayment) && (ShoppingCartControl.PaymentGatewayProvider == null)) { ShoppingCartControl.ButtonNext.Text = GetString("general.ok"); } } // Fill dropdownlist if (!ShoppingCartControl.IsCurrentStepPostBack) { if ((ShoppingCart.CartItems.Count > 0) || ShoppingCartControl.IsInternalOrder) { if (ShoppingCart.ShoppingCartCurrencyID == 0) { // Select customer preferred currency if (ShoppingCart.Customer != null) { CustomerInfo customer = ShoppingCart.Customer; ShoppingCart.ShoppingCartCurrencyID = (customer.CustomerUser != null) ? customer.CustomerUser.GetUserPreferredCurrencyID(SiteContext.CurrentSiteName) : 0; } } if (ShoppingCart.ShoppingCartCurrencyID == 0) { if (SiteContext.CurrentSite != null) { ShoppingCart.ShoppingCartCurrencyID = SiteContext.CurrentSite.SiteDefaultCurrencyID; } } selectCurrency.CurrencyID = ShoppingCart.ShoppingCartCurrencyID; if (ShoppingCart.ShoppingCartDiscountCouponID > 0) { // Fill textbox with discount coupon code DiscountCouponInfo dci = DiscountCouponInfoProvider.GetDiscountCouponInfo(ShoppingCart.ShoppingCartDiscountCouponID); if (dci != null) { if (ShoppingCart.IsCreatedFromOrder || dci.IsValid) { txtCoupon.Text = dci.DiscountCouponCode; } else { ShoppingCart.ShoppingCartDiscountCouponID = 0; } } } } ReloadData(); } // Check if customer is enabled if ((ShoppingCart.Customer != null) && (!ShoppingCart.Customer.CustomerEnabled)) { HideCartContent(GetString("ecommerce.cartcontent.customerdisabled")); } // Turn on available items checking after content is loaded ShoppingCart.CheckAvailableItems = true; base.OnLoad(e); }