Working with the Shopping Cart Web Part

The Cart Web Part displays the current contents of the shopping cart.

Architecture

The Cart Web Part contains the following components:

  • Cart.ascx User Control. Defines the possible actions that the user can take and handles these events. This user control includes an XsltBasketControl server control.

  • XsltBasketControl Web Control. Builds an XML stream from the Basket commerce entity and then applies the specified template. Derived from XsltBaseControl.

  • ShoppingController. Encapsulates all API calls relating to putting items in a cart and checkout-related operations.

Properties

The following table lists and describes the properties that you can choose for display.

Property

Maps to

Type

Description

Default

Template To Display

XslTemplateUri

String

Template file used to render the lists in the browser.

Sample_MyWishLists

Continue Shopping Page

ContinueShoppingUrl

String

URL to redirect the shopper to continue shopping

/Pages/default.aspx

Checkout Page

CheckoutUrl

String

URL to redirect the shopper to the Cart page.

/Pages/checkout.aspx

Line Item Columns

LineItemColumnNames

String

A comma-separated list of columns to display. An empty list is interpreted as "all available columns".

The default column names. See table below.

Display 'move to list' button

DisplayMoveToShopperList

Boolean

If checked, a "Move to List" button will be displayed, allowing the shopper to move an item out of the cart and into a list.

Checked

The following table lists and describes the Line Item Columns that can be displayed.

Property

Description

Product ID (optional)

The product identifier property, retrieved from the catalog.

Name

The name of the product, retrieved from the catalog.

Description

Description of the product, retrieved from the catalog.

Options

Variant options (color, size), retrieved from the product definition.

Availability

Inventory status.

Quantity

Changing the quantity of a line item does not trigger the recalculation of the line item price or the removal of the item if the quantity is set to zero. Instead, the shopper manually selects the "Update Cart" link or button to limit the number of server callbacks and improve performance.

Item Price

Price per item (unit price)

Total

Sum for line item (quantity * unit price)

Toolbox

Displays links and icons to perform various options. (Deleting the Line Item, Add to a Shopping list).

Image

Displays an image of the product

Customization

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

Error Handling

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

API Dependencies

The dependencies on the API are:

  • Basic operations relating to the Basket commerce entity and related items:

    • Create/modify/delete/retrieve line items

    • Create/modify/delete/retrieve addresses

    • Create/modify/delete/retrieve payments

    • Create/Modify/Delete/Retrieve PromoCodes

    • Retrieve shipments

    • Retrieve discounts

  • Retrieve available payment methods

  • Retrieve available shipping methods

See Also

Other Resources

Developing with SharePoint Commerce Services

Developing with Orders Web Parts

Shopping Cart Web Part