This server behavior is used to store the customers Order Details information into the database for later retrieval and processing. This server behavior can be applied to any page that contains the shopping cart to submit the contents of the cart to your database. This behavior create the record in the Order table and create the Order Details record all in one, after the order record is created get the IdOrder and for each item in the cart collection create a record in the Order Details table.
After the order is created the cart save the IdOrder in the session you setup in the config panel and you can get this value from the DataSource in the field "Id Order" the field with this icon
Get value from:
Select the HTML form used to enter the data. The Order will be created on submit this form.
In the After Inserting, Go To text box, enter the page to open after the Order is inserted into the DataBase or click Browse to browse to the file.
In the Connection pop-up menu, select a connection to the database.
Click the Define button if you need to define a connection.
This part work like the standard insert record Dreamweaver behavior. Create the order record and put in this record all the form fields you need. For example you can insert the shipping address form fields in the page and store the value in the order table or other info you need ask to the buyers for the order.
Select the table where create the Order record
Unique column key:
In the Unique Key Column pop-up menus, select a key column (usually the record ID column) to identify the record in the database table. After the Order record is created in the DataBase the IdOrder value is stored in a Session variable and You can get the IdOrder from the DataSouce list values.
The session variable name is: session("dwzCartIdOrder")
Specify a database column to update, select the form object that will update the column from the Value pop-up menu, and then select a data type for the form object from the Submit As pop-up menu. The data type is the kind of data the column in your database table is expecting (text, numeric, Boolean checkbox values). Repeat the procedure for each form object in your form.
This part create the details order record, one record for each item in the cart collection and put in this record the IdOrder in the "Order Id Field" to create the relationship key between the order record and the order details records.
Order detail table:
The DataBase table where create the order details record
Order Id field:
The field in the order details record where put the IdOrder to create the relationship key between the order record and the order details records.
Specify a database column to update, select the cart column object that will update the column from the Value pop-up menu, and then select a data type for the cart column object from the Submit As pop-up menu. The data type is the kind of data the column in your database table is expecting (text, numeric, Boolean checkbox values). Repeat the procedure for each cart column object in your cart.