The CommerceCommandServlet
provides a foundation for URL-based actions. Out of the box, you can allow a user to add an item to his or her order by clicking a URL. Because this process is part of the request-handling pipeline (which handles all Oracle ATG Web Commerce requests and responses), each time a page is requested, the request will be checked to see if it includes Commerce item information.
Consider the following example request URL:
http://yoursite.com/yourpage.jsp?dcs_action=additemtocart&url_catalog_ref_
id=sku10001&url_product_id=prod10001&url_quantity=1&dcs_ci_catalogKey=en_
US&dcs_subsku=sku10001,prod10001,2&dcs_subsku=sku10002,prod10002,1
The dcs_action
flag notifies the request-handling pipeline of the action to be performed, and additional parameters give specifics for the action. The following table explains the URL elements:
Element | Function |
---|---|
| (Required) When You can extend the The |
| (Required) The SKU of the product to add to the cart. |
| (Required) The product ID of the product to add to the cart. |
| (Required) The quantity of the SKU to add to the cart. |
| The ID of the |
| A string specifying which |
| The ID of the |
| An identifier for setting a |
| An identifier for a configurable property of a If you need to add two different computer configurations, you must issue two separate requests to Commerce to add each of the configurations as separate |
The first four parameters listed in the table above are required. If no other parameters are supplied, the servlet creates a CommerceItem
and adds it to the cart.
If a dcs_subsku
parameter is in the URL, then the base SKU/product is represented in a ConfigurableCommerceItem
object and the sub-SKU is represented in a SubSkuCommerceItem
object. SubSkuCommerceItem
is a subclass of CommerceItemImpl
.
If all required parameters and shipping_group_id
are supplied, then the item is added to the ShippingGroup
with the specified ID.