How the shopping cart works

Created by Vidar Langberget

When a visitor adds a product to the shopping cart, the system creates an Order node with the OrderStatus property set to Basket. If the user is anonymous (not logged in) a cookie is stored with the node id of the order. When the visitor returns at a later date, the system looks for the cookie, and if present, the order is loaded, and related to the current session.

If the visitor logs in after having added one or more products to the cart, the order related to the anonymous session is transferred to the logged in user. The SystemUser content class has a property called Orders, which contains all the related orders in various states of completion.