The GWPFormHandler
provides page coders with a means to allow customers to select gift items in their shopping carts. The form handler can be found at /atg/commerce/promotion/GWPFormHandler
, and is based on the atg.commerce.promotion.GWPFormHandler
class.
The form handler gives access to the following methods in the GWPManager class:
makeGiftSelection
— Allows the customer to select a gift item or replace a selected item with the same quantity.handleRemoveSelectableQuantity
—Removes a specified quantity of the gift items (placeholders) from the order.handleRemoveAllSelectableQuantity
—Removes all selectable quantities from the order.
See the ATG Commerce Programming Guide for information the GWPManager.
You can extend the form handler to provide additional functionality as needed.
The form handler includes the following configurable properties:
currentSelectedItemId
—Specify an item ID here to replace an existing gift selection.promotionId
—The Gift with Purchase promotion for which to make the selection.giftHashCode
—The gift item within the promotion for which to make the selection.productId
—Product ID for the new selection.skuId
—SKU ID for the new selection.quantity
—Amount of the new selection.order
—If not configured then the current shopping cart order is used. Default configuration is to use the current order.shippingGroup
—Shipping group to add the new selection to. If not specified, then the first shipping group in the order will be used.commerceItemType
—Commerce item type of the new selection.siteId
—Site the new selection is in.makeGiftSelectionSuccessURL
—URL to redirect to if the selection was successful.makeGiftSelectionErrorURL
—URL to redirect to if the selection was not successful.
The form handler also includes two flags that control whether a new gift selection should first replace a removed or failed quantity before replacing a selected item:
replaceRemovedQuantity
replaceFailedQuantity
Both flags are false by default.
See the ATG Platform API Reference for additional information.