/// <summary> /// Back button actions. /// </summary> public override void ButtonBackClickAction() { // Save the values to ShoppingCart ViewState ShoppingCartControl.SetTempValue(ORDER_NOTE, txtNote.Text); base.ButtonBackClickAction(); }
public override bool ProcessStep() { try { //int paymentID = ValidationHelper.GetInteger(SessionHelper.GetValue("PaymentID"), 0); int paymentID = ShippingExtendedInfoProvider.GetCustomFieldValue(ShoppingCart, "ShoppingCartPaymentID"); // Cleanup the ShoppingCart ViewState ShoppingCartControl.SetTempValue(SHIPPING_OPTION_ID, null); ShoppingCartControl.SetTempValue(PAYMENT_OPTION_ID, null); //ShoppingCart.ShoppingCartShippingOptionID = selectShipping.ShippingID; //ShoppingCart.ShoppingCartPaymentOptionID = selectPayment.PaymentID; ShoppingCart.ShoppingCartShippingOptionID = IsShippingNeeded ? GetShippingID() : selectShipping.ShippingID; ShoppingCart.ShoppingCartPaymentOptionID = paymentID; // Update changes in database only when on the live site if (!ShoppingCartControl.IsInternalOrder) { ShoppingCartInfoProvider.SetShoppingCartInfo(ShoppingCart); } return(true); } catch (Exception ex) { lblError.Visible = true; lblError.Text = ex.Message + " /step " + IsShippingNeeded.ToString(); return(false); } }
public override bool ProcessStep() { try { // Cleanup the ShoppingCart ViewState ShoppingCartControl.SetTempValue(SHIPPING_OPTION_ID, null); ShoppingCartControl.SetTempValue(PAYMENT_OPTION_ID, null); ShoppingCart.ShoppingCartShippingOptionID = selectShipping.SelectedID; ShoppingCart.ShoppingCartPaymentOptionID = selectPayment.SelectedID; // Update changes in database only when on the live site if (!ShoppingCartControl.IsInternalOrder) { ShoppingCartInfoProvider.SetShoppingCartInfo(ShoppingCart); } return(true); } catch (Exception ex) { lblError.Visible = true; lblError.Text = ex.Message; return(false); } }
/// <summary> /// Back button actions. /// </summary> public override void ButtonBackClickAction() { // Save the values to ShoppingCart ViewState ShoppingCartControl.SetTempValue(SHIPPING_OPTION_ID, selectShipping.ShippingID); ShoppingCartControl.SetTempValue(PAYMENT_OPTION_ID, selectPayment.PaymentID); base.ButtonBackClickAction(); }
/// <summary> /// Saves order information from ShoppingCartInfo object to database as new order. /// </summary> public override bool ProcessStep() { // Load first step if there is no address if (ShoppingCart.ShoppingCartBillingAddress == null) { ShoppingCartControl.LoadStep(0); return(false); } // Deal with order note ShoppingCartControl.SetTempValue(ORDER_NOTE, null); ShoppingCart.ShoppingCartNote = TextHelper.LimitLength(txtNote.Text.Trim(), txtNote.MaxLength); try { // Set order culture ShoppingCart.ShoppingCartCulture = LocalizationContext.PreferredCultureCode; // Create order ShoppingCartInfoProvider.SetOrder(ShoppingCart); } catch (Exception ex) { // Show error lblError.Text = GetString("Ecommerce.OrderPreview.ErrorOrderSave"); // Log exception Service.Resolve <IEventLogService>().LogException("Shopping cart", "SAVEORDER", ex, ShoppingCart.ShoppingCartSiteID); return(false); } // Track order activity string siteName = SiteContext.CurrentSiteName; if (LogActivityForCustomer) { var mainCurrency = CurrencyInfoProvider.GetMainCurrency(ShoppingCart.ShoppingCartSiteID); var grandTotalInMainCurrency = Service.Resolve <ICurrencyConverterService>().Convert(ShoppingCart.GrandTotal, ShoppingCart.Currency.CurrencyCode, mainCurrency.CurrencyCode, ShoppingCart.ShoppingCartSiteID); var formattedPrice = CurrencyInfoProvider.GetFormattedPrice(grandTotalInMainCurrency, mainCurrency); ShoppingCartControl.TrackActivityPurchasedProducts(ShoppingCart, siteName, ContactID); ShoppingCartControl.TrackActivityPurchase(ShoppingCart.OrderId, ContactID, SiteContext.CurrentSiteName, RequestContext.CurrentRelativePath, grandTotalInMainCurrency, formattedPrice); } // Raise finish order event ShoppingCartControl.RaiseOrderCompletedEvent(); if (chkSendEmail.Checked) { // Send order notification emails OrderInfoProvider.SendOrderNotificationToAdministrator(ShoppingCart); OrderInfoProvider.SendOrderNotificationToCustomer(ShoppingCart); } return(true); }
/// <summary> /// Back button actions. /// </summary> public override void ButtonBackClickAction() { // Save the values to ShoppingCart ViewState string note = TextHelper.LimitLength(txtNote.Text.Trim(), txtNote.MaxLength); ShoppingCartControl.SetTempValue(ORDER_NOTE, note); base.ButtonBackClickAction(); }
protected void selectPayment_Changed(object sender, EventArgs e) { ShoppingCartControl.SetTempValue(PAYMENT_OPTION_ID, selectPayment.SelectedID); if (ShoppingCart != null) { ShoppingCart.ShoppingCartPaymentOptionID = selectPayment.SelectedID; ShoppingCart.Evaluate(); } }
/// <summary> /// Removes billing address values from ShoppingCart ViewState. /// </summary> private void RemoveBillingTempValues() { // Billing address values ShoppingCartControl.SetTempValue(BILLING_ADDRESS_ID, null); ShoppingCartControl.SetTempValue(BILLING_ADDRESS_CITY, null); ShoppingCartControl.SetTempValue(BILLING_ADDRESS_COUNTRY_ID, null); ShoppingCartControl.SetTempValue(BILLING_ADDRESS_LINE1, null); ShoppingCartControl.SetTempValue(BILLING_ADDRESS_LINE2, null); ShoppingCartControl.SetTempValue(BILLING_ADDRESS_NAME, null); ShoppingCartControl.SetTempValue(BILLING_ADDRESS_PHONE, null); ShoppingCartControl.SetTempValue(BILLING_ADDRESS_STATE_ID, null); ShoppingCartControl.SetTempValue(BILLING_ADDRESS_ZIP, null); }
/// <summary> /// Removes company address values from ShoppingCart ViewState. /// </summary> private void RemoveCompanyTempValues() { // Company address values ShoppingCartControl.SetTempValue(COMPANY_ADDRESS_CHECKED, null); ShoppingCartControl.SetTempValue(COMPANY_ADDRESS_ID, null); ShoppingCartControl.SetTempValue(COMPANY_ADDRESS_CITY, null); ShoppingCartControl.SetTempValue(COMPANY_ADDRESS_COUNTRY_ID, null); ShoppingCartControl.SetTempValue(COMPANY_ADDRESS_LINE1, null); ShoppingCartControl.SetTempValue(COMPANY_ADDRESS_LINE2, null); ShoppingCartControl.SetTempValue(COMPANY_ADDRESS_NAME, null); ShoppingCartControl.SetTempValue(COMPANY_ADDRESS_PHONE, null); ShoppingCartControl.SetTempValue(COMPANY_ADDRESS_STATE_ID, null); ShoppingCartControl.SetTempValue(COMPANY_ADDRESS_ZIP, null); }
public override bool ProcessStep() { try { // Cleanup the ShoppingCart ViewState ShoppingCartControl.SetTempValue(SHIPPING_OPTION_ID, null); ShoppingCartControl.SetTempValue(PAYMENT_OPTION_ID, null); ShoppingCart.ShoppingCartShippingOptionID = selectShipping.SelectedID; ShoppingCart.ShoppingCartPaymentOptionID = selectPayment.SelectedID; return(true); } catch (Exception ex) { lblError.Visible = true; lblError.Text = ex.Message; return(false); } }
/// <summary> /// Back button actions. /// </summary> public override void ButtonBackClickAction() { // Billing address values ShoppingCartControl.SetTempValue(BILLING_ADDRESS_ID, drpBillingAddr.SelectedValue); ShoppingCartControl.SetTempValue(BILLING_ADDRESS_CITY, txtBillingCity.Text); ShoppingCartControl.SetTempValue(BILLING_ADDRESS_COUNTRY_ID, CountrySelector1.CountryID); ShoppingCartControl.SetTempValue(BILLING_ADDRESS_LINE1, txtBillingAddr1.Text); ShoppingCartControl.SetTempValue(BILLING_ADDRESS_LINE2, txtBillingAddr2.Text); ShoppingCartControl.SetTempValue(BILLING_ADDRESS_NAME, txtBillingName.Text); ShoppingCartControl.SetTempValue(BILLING_ADDRESS_PHONE, txtBillingPhone.Text); ShoppingCartControl.SetTempValue(BILLING_ADDRESS_STATE_ID, CountrySelector1.StateID); ShoppingCartControl.SetTempValue(BILLING_ADDRESS_ZIP, txtBillingZip.Text); // Shipping address values ShoppingCartControl.SetTempValue(SHIPPING_ADDRESS_CHECKED, chkShippingAddr.Checked); ShoppingCartControl.SetTempValue(SHIPPING_ADDRESS_ID, drpShippingAddr.SelectedValue); ShoppingCartControl.SetTempValue(SHIPPING_ADDRESS_CITY, txtShippingCity.Text); ShoppingCartControl.SetTempValue(SHIPPING_ADDRESS_COUNTRY_ID, CountrySelector2.CountryID); ShoppingCartControl.SetTempValue(SHIPPING_ADDRESS_LINE1, txtShippingAddr1.Text); ShoppingCartControl.SetTempValue(SHIPPING_ADDRESS_LINE2, txtShippingAddr2.Text); ShoppingCartControl.SetTempValue(SHIPPING_ADDRESS_NAME, txtShippingName.Text); ShoppingCartControl.SetTempValue(SHIPPING_ADDRESS_PHONE, txtShippingPhone.Text); ShoppingCartControl.SetTempValue(SHIPPING_ADDRESS_STATE_ID, CountrySelector2.StateID); ShoppingCartControl.SetTempValue(SHIPPING_ADDRESS_ZIP, txtShippingZip.Text); // Company address values ShoppingCartControl.SetTempValue(COMPANY_ADDRESS_CHECKED, chkCompanyAddress.Checked); ShoppingCartControl.SetTempValue(COMPANY_ADDRESS_ID, drpCompanyAddress.SelectedValue); ShoppingCartControl.SetTempValue(COMPANY_ADDRESS_CITY, txtCompanyCity.Text); ShoppingCartControl.SetTempValue(COMPANY_ADDRESS_COUNTRY_ID, CountrySelector3.CountryID); ShoppingCartControl.SetTempValue(COMPANY_ADDRESS_LINE1, txtCompanyLine1.Text); ShoppingCartControl.SetTempValue(COMPANY_ADDRESS_LINE2, txtCompanyLine2.Text); ShoppingCartControl.SetTempValue(COMPANY_ADDRESS_NAME, txtCompanyName.Text); ShoppingCartControl.SetTempValue(COMPANY_ADDRESS_PHONE, txtCompanyPhone.Text); ShoppingCartControl.SetTempValue(COMPANY_ADDRESS_STATE_ID, CountrySelector3.StateID); ShoppingCartControl.SetTempValue(COMPANY_ADDRESS_ZIP, txtCompanyZip.Text); base.ButtonBackClickAction(); }
/// <summary> /// Saves order information from ShoppingCartInfo object to database as new order. /// </summary> public override bool ProcessStep() { // Load first step if there is no address if (ShoppingCart.ShoppingCartBillingAddressID <= 0) { ShoppingCartControl.LoadStep(0); return(false); } // Check if customer is enabled if ((ShoppingCart.Customer != null) && (!ShoppingCart.Customer.CustomerEnabled)) { lblError.Text = GetString("ecommerce.cartcontent.customerdisabled"); return(false); } // Deal with order note ShoppingCartControl.SetTempValue(ORDER_NOTE, null); ShoppingCart.ShoppingCartNote = txtNote.Text.Trim(); try { // Set order culture ShoppingCart.ShoppingCartCulture = LocalizationContext.PreferredCultureCode; // Update customer preferences CustomerInfoProvider.SetCustomerPreferredSettings(ShoppingCart); // Create order ShoppingCartInfoProvider.SetOrder(ShoppingCart); } catch (Exception ex) { // Show error lblError.Text = GetString("Ecommerce.OrderPreview.ErrorOrderSave"); // Log exception EventLogProvider.LogException("Shopping cart", "SAVEORDER", ex, ShoppingCart.ShoppingCartSiteID, null); return(false); } // Track order items conversions ECommerceHelper.TrackOrderItemsConversions(ShoppingCart); // Track order conversion string name = ShoppingCartControl.OrderTrackConversionName; ECommerceHelper.TrackOrderConversion(ShoppingCart, name); // Track order activity string siteName = SiteContext.CurrentSiteName; if (LogActivityForCustomer) { ShoppingCartControl.TrackActivityPurchasedProducts(ShoppingCart, siteName, ContactID); ShoppingCartControl.TrackActivityPurchase(ShoppingCart.OrderId, ContactID, SiteContext.CurrentSiteName, RequestContext.CurrentRelativePath, ShoppingCart.TotalPriceInMainCurrency, CurrencyInfoProvider.GetFormattedPrice(ShoppingCart.TotalPriceInMainCurrency, CurrencyInfoProvider.GetMainCurrency(CMSContext.CurrentSiteID))); } // Raise finish order event ShoppingCartControl.RaiseOrderCompletedEvent(); // When in CMSDesk if (ShoppingCartControl.IsInternalOrder) { if (chkSendEmail.Checked) { // Send order notification emails OrderInfoProvider.SendOrderNotificationToAdministrator(ShoppingCart); //OrderInfoProvider.SendOrderNotificationToCustomer(ShoppingCart); //EventLogProvider p = new EventLogProvider(); //p.LogEvent("I", DateTime.Now, "Envoi de mail d'achat au client"+ShoppingCart.Customer.CustomerEmail, "code BO"); sendconf2(null, null, null); } } // When on the live site else if (ECommerceSettings.SendOrderNotification(SiteContext.CurrentSite.SiteName)) { // Send order notification emails OrderInfoProvider.SendOrderNotificationToAdministrator(ShoppingCart); OrderInfoProvider.SendOrderNotificationToCustomer(ShoppingCart); } return(true); }
/// <summary> /// Saves order information from ShoppingCartInfo object to database as new order. /// </summary> public override bool ProcessStep() { // Load first step if there is no address if (IsShippingNeeded && ShoppingCart.ShoppingCartBillingAddressID <= 0) { ShoppingCartControl.LoadStep(0); return(false); } // Check if customer is enabled if ((ShoppingCart.Customer != null) && (!ShoppingCart.Customer.CustomerEnabled)) { lblError.Text = GetString("ecommerce.cartcontent.customerdisabled"); return(false); } // Deal with order note ShoppingCartControl.SetTempValue(ORDER_NOTE, null); ShoppingCart.ShoppingCartNote = txtNote.Text.Trim(); try { // Set order culture ShoppingCart.ShoppingCartCulture = LocalizationContext.PreferredCultureCode; // Update customer preferences CustomerInfoProvider.SetCustomerPreferredSettings(ShoppingCart); // Create order ShoppingCartInfoProvider.SetOrder(ShoppingCart); ShoppingCart.Order.SetValue("OrderBundleData", ShoppingCart.GetStringValue("ShoppingCartBundleData", string.Empty)); } catch (Exception ex) { // Show error lblError.Text = GetString("Ecommerce.OrderPreview.ErrorOrderSave"); // Log exception EventLogProvider.LogException("Shopping cart", "SAVEORDER", ex, ShoppingCart.ShoppingCartSiteID, null); return(false); } // Track order items conversions ECommerceHelper.TrackOrderItemsConversions(ShoppingCart); // Track order conversion string name = ShoppingCartControl.OrderTrackConversionName; ECommerceHelper.TrackOrderConversion(ShoppingCart, name); // Track order activity string siteName = SiteContext.CurrentSiteName; if (LogActivityForCustomer) { ShoppingCartControl.TrackActivityPurchasedProducts(ShoppingCart, siteName, ContactID); ShoppingCartControl.TrackActivityPurchase(ShoppingCart.OrderId, ContactID, SiteContext.CurrentSiteName, RequestContext.CurrentRelativePath, ShoppingCart.TotalPriceInMainCurrency, CurrencyInfoProvider.GetFormattedPrice(ShoppingCart.TotalPriceInMainCurrency, CurrencyInfoProvider.GetMainCurrency(CMSContext.CurrentSiteID))); } // Raise finish order event ShoppingCartControl.RaiseOrderCompletedEvent(); string currentCultureCode = DocumentContext.CurrentDocument.DocumentCulture; string template = "Ecommerce.OrderNotificationToCustomer" + currentCultureCode; // When in CMSDesk if (ShoppingCartControl.IsInternalOrder) { if (chkSendEmail.Checked) { // Send order notification emails OrderInfoProvider.SendOrderNotificationToAdministrator(ShoppingCart); OrderInfoProvider.SendOrderNotificationToCustomer(ShoppingCart, template); } } // When on the live site else if (ECommerceSettings.SendOrderNotification(SiteContext.CurrentSite.SiteName)) { // Send order notification emails OrderInfoProvider.SendOrderNotificationToAdministrator(ShoppingCart); OrderInfoProvider.SendOrderNotificationToCustomer(ShoppingCart, template); } /*desactiver le coupon code*/ if (Session["CouponValue"] != null) { DiscountCouponInfo dci = DiscountCouponInfoProvider.GetDiscountCouponInfo(Session["CouponValue"].ToString(), ShoppingCart.SiteName); if ((dci != null) && (((ShoppingCart.IsCreatedFromOrder) && (ShoppingCart.ShoppingCartDiscountCouponID == dci.DiscountCouponID)) || dci.IsValid)) { DateTime d = DateTime.Now; d = d.AddMinutes(5); dci.DiscountCouponValidTo = d; Session["CouponValue"] = null; } } /**/ return(true); }
protected void selectPayment_Changed(object sender, EventArgs e) { ShoppingCartControl.SetTempValue(PAYMENT_OPTION_ID, selectPayment.SelectedID); }
/// <summary> /// Saves order information from ShoppingCartInfo object to database as new order. /// </summary> public override bool ProcessStep() { // Load first step if there is no address if (ShoppingCart.ShoppingCartBillingAddress == null) { ShoppingCartControl.LoadStep(0); return(false); } // Deal with order note ShoppingCartControl.SetTempValue(ORDER_NOTE, null); ShoppingCart.ShoppingCartNote = TextHelper.LimitLength(txtNote.Text.Trim(), txtNote.MaxLength); try { // Set order culture ShoppingCart.ShoppingCartCulture = LocalizationContext.PreferredCultureCode; // Create order ShoppingCartInfoProvider.SetOrder(ShoppingCart); } catch (Exception ex) { // Show error lblError.Text = GetString("Ecommerce.OrderPreview.ErrorOrderSave"); // Log exception EventLogProvider.LogException("Shopping cart", "SAVEORDER", ex, ShoppingCart.ShoppingCartSiteID); return(false); } if (!ShoppingCartControl.IsInternalOrder) { // Track order items conversions ECommerceHelper.TrackOrderItemsConversions(ShoppingCart); // Track order conversion string name = ShoppingCartControl.OrderTrackConversionName; ECommerceHelper.TrackOrderConversion(ShoppingCart, name); } // Track order activity string siteName = SiteContext.CurrentSiteName; if (LogActivityForCustomer) { ShoppingCartControl.TrackActivityPurchasedProducts(ShoppingCart, siteName, ContactID); ShoppingCartControl.TrackActivityPurchase(ShoppingCart.OrderId, ContactID, SiteContext.CurrentSiteName, RequestContext.CurrentRelativePath, ShoppingCart.TotalPriceInMainCurrency, CurrencyInfoProvider.GetFormattedPrice(ShoppingCart.TotalPriceInMainCurrency, CurrencyInfoProvider.GetMainCurrency(SiteContext.CurrentSiteID))); } // Raise finish order event ShoppingCartControl.RaiseOrderCompletedEvent(); // When in CMSDesk if (ShoppingCartControl.IsInternalOrder) { if (chkSendEmail.Checked) { // Send order notification emails OrderInfoProvider.SendOrderNotificationToAdministrator(ShoppingCart); OrderInfoProvider.SendOrderNotificationToCustomer(ShoppingCart); } } // When on the live site else if (ECommerceSettings.SendOrderNotification(SiteContext.CurrentSite.SiteName)) { // Send order notification emails OrderInfoProvider.SendOrderNotificationToAdministrator(ShoppingCart); OrderInfoProvider.SendOrderNotificationToCustomer(ShoppingCart); } return(true); }