The GiftWithPurchaseFormHandler 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/ GiftWithPurchaseFormHandler, and is based on the atg.commerce.promotion. GiftWithPurchaseFormHandler class.

The form handler gives access to the following methods in the GiftWithPurchaseFormHandler class:

See the Core Commerce Programming Guide for additional information on the GiftWithPurchaseFormHandler.

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, and quantityWithFraction: 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.


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