/// <summary> /// Gets and updates checkout process step. Called when the "Get and update step" button is pressed. /// Expects the CreateCheckoutProcessStep method to be run first. /// </summary> private bool GetAndUpdateCheckoutProcessStep() { CheckoutProcessInfo checkoutProcess = new CheckoutProcessInfo(); checkoutProcess.LoadXmlDefinition(ECommerceSettings.CheckoutProcess(CMSContext.CurrentSiteName)); CheckoutProcessStepInfo updateStep = checkoutProcess.GetCheckoutProcessStepInfo("MyNewStep"); if (updateStep != null) { // Update the property updateStep.Caption = updateStep.Caption.ToLowerCSafe(); // Update xml definition checkoutProcess.SetCheckoutProcessStepNode(updateStep); // Update the checkout process SettingsKeyProvider.SetValue(CMSContext.CurrentSiteName + "." + ECommerceSettings.CHECKOUT_PROCESS, checkoutProcess.GetXmlDefinition()); return true; } return false; }
/// <summary> /// Gets and bulk update checkout process steps. Called when the "Get and bulk update steps" button is pressed. /// Expects the CreateCheckoutProcessStep method to be run first. /// </summary> private bool GetAndBulkUpdateCheckoutProcessSteps() { bool success = false; CheckoutProcessInfo checkoutProcess = new CheckoutProcessInfo(); checkoutProcess.LoadXmlDefinition(ECommerceSettings.CheckoutProcess(CMSContext.CurrentSiteName)); // Get the list List<CheckoutProcessStepInfo> steps = checkoutProcess.GetCheckoutProcessSteps(CheckoutProcessEnum.CMSDeskOrder); foreach (CheckoutProcessStepInfo updateStep in steps) { if (updateStep.Name == "MyNewStep") { // Update the property updateStep.Caption = updateStep.Caption.ToUpper(); // Update xml definition checkoutProcess.SetCheckoutProcessStepNode(updateStep); success = true; } } // Update the checkout process SettingsKeyProvider.SetValue(CMSContext.CurrentSiteName + "." + ECommerceSettings.CHECKOUT_PROCESS, checkoutProcess.GetXmlDefinition()); return success; }
/// <summary> /// Deletes checkout process step. Called when the "Delete step" button is pressed. /// Expects the CreateCheckoutProcessStep method to be run first. /// </summary> private bool DeleteCheckoutProcessStep() { // Create new checkout process CheckoutProcessInfo checkoutProcess = new CheckoutProcessInfo(); // Load checkout process xml definition checkoutProcess.LoadXmlDefinition(ECommerceSettings.CheckoutProcess(CMSContext.CurrentSiteName)); // Get 'My new step' checkout process step CheckoutProcessStepInfo deleteStep = checkoutProcess.GetCheckoutProcessStepInfo("MyNewStep"); if (deleteStep != null) { // Delete the step checkoutProcess.RemoveCheckoutProcessStepNode("MyNewStep"); // Save the data SettingsKeyProvider.SetValue(CMSContext.CurrentSiteName + "." + ECommerceSettings.CHECKOUT_PROCESS, checkoutProcess.GetXmlDefinition()); return true; } return false; }
/// <summary> /// Generates default checkout process. Called when the "Generate default process" button is pressed. /// </summary> private bool GenerateDefaultCheckoutProcess() { // Create new checkout process object CheckoutProcessInfo checkoutProcess = new CheckoutProcessInfo(); // Load default checkout process xml definition checkoutProcess.LoadXmlDefinition(ShoppingCart.DEFAULT_CHECKOUT_PROCESS); // Save the data SettingsKeyProvider.SetValue(CMSContext.CurrentSiteName + "." + ECommerceSettings.CHECKOUT_PROCESS, checkoutProcess.GetXmlDefinition()); return true; }
/// <summary> /// Creates checkout process step. Called when the "Create step" button is pressed. /// </summary> private bool CreateCheckoutProcessStep() { // Create new checkout process step object CheckoutProcessStepInfo newStep = new CheckoutProcessStepInfo(); // Set the properties newStep.Name = "MyNewStep"; newStep.Caption = "My new step"; newStep.ControlPath = ""; newStep.ShowInCMSDeskCustomer = true; newStep.ShowInCMSDeskOrder = true; newStep.ShowOnLiveSite = true; newStep.ShowInCMSDeskOrderItems = true; // Insert node CheckoutProcessInfo checkoutProcess = new CheckoutProcessInfo(); checkoutProcess.LoadXmlDefinition(ECommerceSettings.CheckoutProcess(CMSContext.CurrentSiteName)); checkoutProcess.SetCheckoutProcessStepNode(newStep); // Create the checkout process SettingsKeyProvider.SetValue(CMSContext.CurrentSiteName + "." + ECommerceSettings.CHECKOUT_PROCESS, checkoutProcess.GetXmlDefinition()); return true; }