To persist the get the values of the custom fields, you have to use the EcommerceCheckoutPageChanging event. It occurs every time the user navigates between the steps of the Checkout widget. In the handler for this event you can get instances of the UI controls for the fields and their values. You subscribe to this event in the Global.asax file. For more information about how to subscribe to this event and its event arguments, see the For development: IEcommerceCheckoutPageChanging event article.
The code for getting and persisting the values of the custom fields, is going to be placed in the handler for the EcommerceCheckoutPageChanging event.To get the values of the fields and persist them in the CartOrder instance, perform the following:
NOTE: Ensure to look for the respective field control only in the corresponding checkout step. It is important to perform this check because of the way the checkout pages are constructed. In some cases you may be able to find the control in a step even when it is actually in another step. In this case you may end up retrieving the wrong value from the control and thus persisting wrong data. Therefore, it is safest to verify the step whenever you save data from a control.
NOTE: The second argument accepted by the GetControl method is of type boolean and indicates whether the control should be treated as required or not. If the control is required and cannot be found, the method will throw an exception. If the control is not required and it does not exist, the method will return null.
NOTE: Information about creating this property can be found in the For developers: Create the custom fields for the CartOrder and Order classes article.
Use the following code sample:
NOTE: The code snippet above also contains the code form the previous article – For developers: Create the custom fields for the CartOrder and Order classes.
Back To Top
Copyright © 2018 Progress Software Corporation and/or its subsidiaries or affiliates.
All Rights Reserved.