Modifying orders by catalogRefId
works for very simple sites. Because it does not provide the granularity necessary to delete just a part of a CommerceItem
, it is not recommended for sites with complex features, such as multiple CommerceItems
with the same catalogRefId
or multiple shipping groups.
You can use the following CartModifierFormHandler
methods to modify an Order
by catalogRefId
:
handleSetOrder()
handleRemoveItemFromOrder()
handleMoveToPurchaseInfo()
Refer to Understanding the CartModifierFormHandler for more information on these handle methods.
To change the quantities of items in an Order
using the catalogRefIds
of CommerceItems
, call the CartModifierFormHandler.handleSetOrder
method for each CommerceItem
whose quantity you want to change and pass in the catalogRefId
and quantity
for the CommerceItem
. This is illustrated in the following JSP code:
<dsp:input bean='beanName' value='<dsp:valueof param="CommerceItem.quantity"/>' type="text" name='<dsp:valueof param="CommerceItem.catalogRefId"/>'/>
Note that if no quantity is found for a CommerceItem
, then the CommerceItem
is removed from the Order
.
To remove items from an Order
using the catalogRefIds
of CommerceItems
, edit the JSPs that invoke the CartModifierFormHandler
handle methods that delete items from the Order
. Populate the form handler’s removalCatalogRefIds
array with the catalogRefIds
of the CommerceItems
to be removed. For example, you can populate the array using following JSP code:
<dsp:input bean="CartModifierFormHandler.removalCatalogRefIds" paramvalue="CommerceItem.catalogRefId" type="checkbox"/>