Commerce Reference Store extends several core Commerce gift with purchase components.
StoreGiftWithPurchaseFormHandler
In Commerce Reference Store, the /atg/commerce/promotion/GiftWithPurchaseFormHandler
component is of class atg.projects.store.promotion.StoreGiftWithPurchaseFormHandler
. This class extends the core Commerce atg.commerce.promotion.GiftWithPurchaseFormHandler
class to handle gift selection when JavaScript is enabled and when it is not. When JavaScript is enabled, gift selection requests are done through AJAX. This allows the application to perform better when validation errors occur because the whole page does not need to be reloaded, only the error messages do. StoreGiftWithPurchaseFormHandler
extends the handleMakeGiftSelection()
method to redirect to different success and error URLs, depending on whether or not the request was made through AJAX. StoreGiftWithPurchaseFormHandler
also extends the preMakeGiftSelection()
method so that the application displays different error messages for each SKU attribute (color, size, wood finish).
StoreGWPManager
In Commerce Reference Store, the /atg/commerce/promotion/GWPManager
component is of class atg.projects.store.promotion.StoreGWPManager
. This class extends the core Commerce atg.commerce.promotion.GWPManager
class. StoreGWPManager
modifies the processAutoAdd()
method in order to check the inventory level of an item before adding it as a gift to the order. Also, this class adds two helper methods:
getQuantityToBeSelected()
determines the gift quantity that is still available for selection in the order.getItemGiftQuantity()
determines gift quantity in the currentCommerceItem
.
StoreGiftWithPurchaseSelectionsDroplet
In Commerce Reference Store, the /atg/commerce/promotion/GiftWithPurchaseSelectionsDroplet
component is of class atg.projects.store.droplet.StoreGiftWithPurchaseSelectionsDroplet
. This class extends the core Commerce atg.commerce.promotion.GiftWithPurchaseSelectionsDroplet
class by adding an additional quantityToBeSelected
output parameter that represents the gift quantity in the order that has not been selected yet.