E-Commerce User Guide : Cart Rules
 
Cart Rules
 
Cart Rules are used to evaluate the contents of the E-Commerce module shopping cart and either enforce the presence or quantity of one or more items in the cart or add one or more items to the cart. Cart Rules are stored in a SiriusSQL table called cartrule and are executed automatically when either the Checkout.aspx or Checkout1.aspx (if using Checkout Steps) page loads. The execution of Cart Rules begins by looking at the DCI of each item in the shopping cart and comparing that to the department, category, and item fields in each row of the cartrule table along with the required and cartrule fields to see if an item is required to be present in the cart and if the correct quantity is present. If the Cart Rule is used to enforce the presence or quantity of an item and that item is in the shopping cart at the correct quantity, then, the sale can be processed; if the item is not present in the cart or is not present in the correct quantity, then, the contents of the message field are displayed on the page which can give the online shopper instructions for adding the item to the shopping cart at the correct quantity. If the Cart Rule is configured to add an item to the shopping cart based on the presence of one or more items in the cart, e.g., adding a shipping fee item if any items from the RETAIL department are present in the cart, then, the contents of the cartaction field are processed.
If you are running multiple sets of pages, you can filter the Cart Rules so that certain Cart Rules apply to certain pages but not to others. To enable this functionality, add the following setting to the site config file:
 
Site Admin Panel > Miscellaneous Settings > WebSiteID value = TicketSales
 
Where "TicketSales" can be anything you want to call one of your sets of pages to differentiate it from your other sets of E-Commerce pages. The WebSiteID key is used to uniquely identify each set of pages. You must also configure the cartrule table in SiriusSQL database. For each Cart Rule in the table, you need to enter the value of the WebSiteID, if you want the Cart Rule to execute for that set of pages. For a Cart Rule to run on multiple sets of pages, you would enter each of the WebSiteIDs as a comma-separated list.
 
Note:
Cart Rules that don’t have a sitefilter set in the cartrule table in the SiriusSQL database, works for all sets of pages, even if the set of pages has a WebSiteID value set.
Sets of pages that don’t have a WebSiteID value configured or are missing that setting altogether from their site config file uses all Cart Rules.