Share via


MiniCart Web Part

The Mini Cart Web Part applies an XSLT template to render a short summary of the shopping cart, including line item count and subtotals.

Architecture

The Mini Cart Web Part contains these components:

  • MiniCartWebPart/SPMiniCartWebPart: applies the XSLT template to render the Mini Cart Web Part HTML code. This component uses the SiteContext class to read and write the subtotal and line items count to the session (which uses an HTTP cookie). If the session does not contain this information, the ShoppingController is called to retrieve the basket. The XML source is a root node called "Basket". The subtotal and line items are passed into the XSLT as arguments.

  • ShoppingController: encapsulates all multi-channel commerce foundation calls relating to putting items in a cart and checkout-related operations. When a basket is loaded or retrieved, the ShoppingController class updates the subtotal and line item count in the session.

Properties

The following table lists the mapping of the properties for the Mini Cart Web Part.

Property

Maps to

Commerce "Basket" to use

BasketName

Customization

You can customize the Mini Cart Web Part by modifying the XSLT template.

Error Handling

There is no design-time error handing required for this Web Part.

Run Time Validation

The following table lists the fields of the Mini Web Cart Part that the Product Query Web Part validates at run time.

Field to validate

Description

Occurs

System response

DisplayNameProperty

Valid if DisplayNameProperty is set.

When rendering the Web Part.

Displays an error indicating that the DisplayNameProperty is required.

In addition, the Mini Cart Web Part handles the following scenarios:

  • Lets a shopper to add a product to the shopping cart with a quantity set to zero (0), a negative number, or a non-digit.

  • Does not let a shopper to add a product to the cart that is out of stock.

API Dependencies

The Retrieve Basket API is a dependency for this Web Part.

See Also

Other Resources

Developing with SharePoint Commerce Services

Orders System Web Parts

Working With the MiniCart Web Part