In order to store the values entered in the UI fields that you have created in the previous step, you have to create custom fields for the CartOrder and Order objects. During the checkout process a CartOrder object is used to gather the information and preserve it in the database.
NOTE: Ecommerce order data is stored in multiple tables. During the checkout process this data is stored in “Cart” tables. These tables act like a temporary buffer to hold all of the information that a customer will enter during the multiple step check out process (shipping address, billing address, selected shipping method, payment method, coupon codes, etc.). Once a customer chooses to actually purchase the items in their cart, the contents of the “Cart” tables are then copied to the similarly named “Order” tables.
Because you will only want to attempt to modify the database structure once, a good place to perform this action is in the Application_Start event handler in the Global.asax file. By default, a new SitefinityWebApp project does not include this file so you will need to add a new Global.asax file to your project. In the Application_Start handler, hook up to the Initialized event of the Bootstrapper class. This event occurs when the first instance of your Sitefinity CMS site is requested. The code in this example is executed only when the CommandName value of the event arguments is equal to ”Bootstrapped”.
To create the fields, you will be using a method named CreateCustomOrderFields(). This method must perform the following:
To create the custom fields for the CartOrder and Order objects, you must perform the following.
Use the following code sample:
Back To Top