Class Name

atg.commerce.order.AddItemToCartServlet

Component(s)

/atg/commerce/order/AddItemToCartServlet

The AddItemToCartServlet servlet bean adds an item to a shopping cart via a URL. This enables product information, such as the SKU and quantity of an item, to be passed as part of a URL to ATG Commerce from a third-party application.

AddItemToCartServlet is called by a servlet in the request-handling pipeline, CommerceCommandServlet (class atg.commerce.order.CommerceCommandServlet). When CommerceCommandServlet receives a dcs_action input parameter of addItemToCart, it calls AddItemToCartServlet.

If only the required parameters for AddItemToCartServlet are supplied, then the servlet bean creates and adds to the cart a commerce item of class atg.commerce.order.CommerceItemImpl. If additional parameters are supplied, then AddItemToCartServlet functions differently depending on which optional parameters are supplied.

Refer to Adding an Item to an Order Via a URL in the Working With Purchase Process Objects chapter in the ATG Commerce Programming Guide for more information on the implementation and behavior of both CommerceCommandServlet and AddItemToCartServlet.

Input Parameters

url_catalog_ref_id (Required)
The SKU of the item to add to the cart.

url_product_id (Required)
The product ID of the item to add to the cart.

url_quantity (Required)
The quantity of the item to add to the cart.

url_shipping_group_id
The ID of the shipping group to which to add the item.

url_item_type
The commerce item type to use to create the commerce item.

url_commerce_item_id
The ID of a commerce item that is removed from the order. Use this parameter when you want to replace one item in the cart with another.

dcs_ci_*
An identifier for setting a CommerceItem property.

If a parameter with this prefix is supplied, then the CommerceItem property to which it refers is set to the given value in the commerce item. For example, if the dcs_ci_catalogKey parameter is supplied with a given value of en_US, then the catalogKey property is set to en_US.

dcs_conf_<n>
An identifier for setting a configurable property of a ConfigurableCommerceItem.

Memory and hard drives are two examples of configurable properties of a computer item. That is, a customer can order various amounts of memory and one or more hard drives for a single computer. Both the memory and the hard drive are represented as subSKUs of the base SKU, the computer item.

If a parameter with this prefix is supplied, then the configurable property to which it refers is set to the specified value. This parameter’s format is as follows:

<n> is an integer representing the configurable property in the list of configurable properties for the given ConfigurableCommerceItem. “sku id”, “product id”, and “individual quantity” provide the data with which to construct a SubSkuCommerceItem to represent the configurable property for the given ConfigurableCommerceItem. “sku id” is the SKU id of the given subSKU. “product id” is the product id of the given subSKU. “individual quantity” is the quantity of the given subSKU to add to a singleConfigurableCommerceItem. For example, if you are adding 2 hard drives to each of 1,000 computers, then the individual quantity of the hard drive subSKU is 2.

dcs_subsku
An identifier for a subSKU. Specify this parameter when you are adding a configurable SKU and its subSKUs to a cart. Values for this parameter must use this format:

SKU_ID,product_ID, quantity,

To specify multiple subSKUs, create a string that includes information about each subSKU separated by commas. For example:

79054,12159,1,79303,11900,4,90931,20133,2
Output Parameters

None. AddItemToCartServlet is called by a servlet in the request-handling pipeline, CommerceCommandServlet.

Open Parameters

None. AddItemToCartServlet is called by a servlet in the request-handling pipeline, CommerceCommandServlet.

Example

No JSP example is provided. AddItemToCartServlet is called by a servlet in the request-handling pipeline, CommerceCommandServlet.

 
loading table of contents...