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:

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:




(Required) When CommerceCommandServlet receives the dcs_action additemtocart, it calls the AddItemToCartServlet.

You can extend the CommerceCommandServlet and the pipeline to let the user trigger some other action by clicking a URL.

The AddItemToCartServlet component includes a pricingOperation parameter, which determines what action the servlet takes when called. The default action is ORDER_TOTAL. The possible actions are included in atg.commerce.pricing.PricingConstants.


(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 ShippingGroup to which to add the item.


A string specifying which CommerceItem type to use.


The ID of the CommerceItem which this configuration should replace. If this parameter is supplied, then this is a reconfiguration.


An identifier for setting a CommerceItem property. For example, dcs_ci_catalogKey=en_US causes the property catalogKey to be set to the value en_US.


An identifier for a configurable property of a CommerceItem. The format is: dcs_subsku=sku id, product id, individual quantity. The individual quantity portion of this parameter reflects the quantity of the item which will be added to a single ConfigurableCommerceItem. For example, if you are adding a computer with 2 hard drives, the individual quantity would be 2. If you were adding 1000 computers, each with 2 hard drives, the individual quantity would still be 2. Oracle ATG Web Commerce handles the multiplication.

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 ConfigurableCommerceItems. For example, dcs_subsku=sku10001,prod10001,2&dcs_subsku=sku10002,prod10002,1 causes the servlet to add a CommerceItem with SKU/product combination sku10001, prod10001 and quantity 2 and SKU/product combination sku10002,prod10002 and quantity 1 to the ConfigurableCommerceItem.

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.

Copyright © 1997, 2013 Oracle and/or its affiliates. All rights reserved. Legal Notices