The standard process for merging orders involves OrderManager.mergeOrders()
calling CommerceItemManager.mergeOrdersCopyCommerceItem()
to copy existing commerce items from a source order to a destination order, and calling ShippingGroupManager.mergeOrdersCopyShippingGroup
to copy existing shipping groups from the source order to the destination order. In the ShippingGroupManager
, mergeOrdersCopyShippingGroup
, in turn, calls either mergeOrdersCopyHardgoodShippingGroup
or mergeOrdersCopyElectronicShippingGroup
, depending on the type of the shipping group.
If you are using the multisite features of Oracle ATG Web Commerce, merging orders must also take site information into account when deciding whether two items are identical, and therefore whether to increment the item count or to add a second item to the order. The methods used are CommerceItemManager.shouldMergeItems()
and shouldMergeSubItems()
.
Note that if you have extended certain Commerce classes to store additional information, you must change the methods used for merging orders so the additional information is copied to the destination order when merging orders.
If you’ve extended
CommerceItem
, you should subclassCommerceItemManager
and override themergeOrdersCopyCommerceItem
method to first call the superclass method to do the basic copy and then copy your extended commerce item data.If you’ve extended
HardgoodShippingGroup
, you should subclassShippingGroupManager
and override themergeOrdersCopyHardgoodShippingGroup
method to first call the superclass method to do the basic copy and then copy your extended commerce item data.If you’ve extended
ElectronicShippingGroup
, you should subclassShippingGroupManager
and override themergeOrdersCopyElectronicShippingGroup
method to first call the superclass method to do the basic copy and then copy your extended commerce item data.If you’ve created a new shipping group type that is neither a subclass of
HardgoodShippingGroup
norElectronicShippingGroup
, you should subclassShippingGroupManager
and override themergeOrdersCopyShippingGroup
method to examine the class of the shipping group. If the shipping group is of the new type you created, then the subclass should copy it to the destination order. Otherwise, the method can call the superclassmergeOrdersCopyShippingGroup
method to handle the standard shipping group types.