The MX Shopping Cart is a collection of server behaviors used in conjunction with a special data source, the Shopping Cart, which can be added to your site from the Data Binding inspector add menu. When the shopping cart is added to a page, it appears as a data source for the page and is manipulated much like other data sources.
In addition to the default columns in the shopping cart, the shopping cart has three leaf nodes that can be used with other DW MX server behaviors:
| [numItems] | |
| sum(Total) | |
| sum(Quantity) |
These are similar to the recordset's [first record index], [last record index] and [total records].
The shopping cart needs to be configured to interact with your database or other components. You do this by setting up bindings to the database or other components when you apply the following server behaviors:
| Add to cart via form OR Add to cart via link | |
| Save cart to table |
A series of interactions with the cart can be set up in the Server Behavior inspector. The following server behaviors are included in the MX Shopping Cart Extension. When you add the shopping cart extension to DW MX, these server behaviors are added to the available behaviors in the Server Behavior inspector. They are found on the Shopping Cart submenu. To use any one of them, you must first add a shopping cart to the page.
A form button must be used if you want to add SKU modifiers (such as color and size), as these items must be submitted via a form. If you choose Link for the Link Type, you cannot use SKU modifiers.
You must specify the source for each column that you want to use in the cart. There are five default columns. The Product ID is required. Other columns are optional; the source should be specified as Nothing if you don't want to use them. The default columns cannot be deleted or changed. You may add other columns as desired.
The parameters are shown in the following table.
Literal Form Element, Form Element Name Recordset, Recset Column, Unique Key Column
There are no parameters.
To use this behavior, you must also have a form element and a form submit button on the page (appropriately labeled Update Cart or similarly). The shopping cart table display and the form button should be inside the form element tag.
The optional parameter to this behavior is Go to URL. Use this parameter if you want to redirect users to a different page after updating the cart. Otherwise, leave it blank and the page will submit to itself and refresh with the new cart contents.
The optional parameter to this behavior is Go to URL. Use this parameter if you want to redirect users to a different page after updating the cart. Otherwise, leave it blank and the page will submit to itself and refresh with the new cart contents.
Add to cart via form OR Add to cart via link
These two server behaviors are used to add an item to the shopping cart. The "Add to cart via form" behavior is applied to a form button, and the "Add to cart via link" behavior is applied to a text or image link. The parameters are the same for both behaviors.
Parameter
Values
Link or Form Element
Name of Link or Form
Binding Type (for each cart column)
None
Go to URL
URL or pagename
Cart repeat region
The Cart Repeat Region behavior is similar to the Repeat Region server behavior used with a dynamic table, but you must be sure to use the shopping cart version in this instance. Apply this behavior to the dynamic row in the table, which is bound to the contents of the shopping cart. It has the effect of repeating the row for as many items as the cart contains.
Update cart
This is applied to a text field form element (quantity edit box) on a page that contains the shopping cart table display. The text field is bound to the Quantity column in the shopping cart and allows the user to change the quantity of any one item.
Empty cart
This is applied to a link on a page that contains the shopping cart table display. The link can be an image or a text link. If no link is selected when the behavior is applied, the default text link "Empty cart" will be created.
| Parameter | Values |
| Link | Link name |
| Connection | Connection name |
| Table | Name of database table for the ID key |
| Field | Name of field containing the ID key |
| Session var | Name of session variable |
You must set up the data source into which the contents will be submitted on the page. The data source to which you are submitting must be a view that is updatable in your database schema.
The parameters are shown in the following table.
Parameter
Values
Link
Link name
Connection
Connection name
Table
Name of database table into which to insert order
Destination column for cart column
Name of column into which to insert each cart column
Destination column for unique ID
Column into which to insert unique ID value
Go to URL
URL or pagename
![]() |
![]() |
![]() |