Developing custom dialogs for the checkout process
|Top Previous Next|
Creating a custom checkout process step
- IsValid() – Validates current step custom data and returns validation result. True – all step data is correct and can be processed, False – some step data is not correct or missing and cannot be processed. In this case appropriate error message should be displayed. By default, it returns True.
- ProcessStep() – Processes current step information (updates shopping cart data) and returns result of this action. True – shopping cart data was updated successfully and customer can be moved to the next checkout process step, False – shopping cart update failed and customer cannot be moved to the next step. In this case appropriate error message should be displayed. By default, it returns True.
- ButtonBackClickAction() – Defines action which is run after the Back button is clicked. By default, the parent shopping cart control method ButtonBackClickAction() is called which moves customer one step backward in the checkout process.
- ButtonNextClickAction() – Defines action which is run after the “Next button” is clicked. By default, the parent shopping cart control method ButtonNextClickAction() is called which moves customer one step forward in the checkout process when the current step data is valid and processed successfully.
- ShoppingCartControl – parent shopping cart control the step belongs to
- ShoppingCartInfoObj – shopping cart object which stores all data during the checkout process
- CheckoutProcessStep – checkout process step information
If the control represents checkout process steps in different checkout process types and these steps differ from each other only a little, you can create one control and specify a different behavior depending on the checkout process type as follows:
Example 1 - My step
The following example shows a simple checkout process step definition. It displays the total price and an editable field to insert a customer comment. After the Next button is clicked, the editable field is checked for emptiness. If it is not empty the customer comment is saved and shopping cart data is updated. Otherwise, an appropriate error message is displayed. If the customer is a member of role “VipCustomers”, an extra step with an additional form for VIP customers is loaded (MyVipStep.ascx). The Back button action is not overridden.
My VIP step
This is an external checkout process step which is not included in standard checkout process definition. It is loaded only when the current customer is a member of role “VipCustomers”, however, you will need to use your own condition for loading your external steps. There is no data validation (Vip customer comment can be empty). Neither “Back button action” nor “Next button action” is overridden so it means the standard methods are called after the Back button and Next button are clicked.