Controller for gift certificate purchases.
Members
(static) AddToBasket
Adds a gift certificate to the basket.
- Source:
- See:
(static) CheckBalance
Displays the details of a gift certificate to check the current balance.
- Source:
- See:
(static) Edit
Updates and renders the gift certificate purchase page.
- Source:
- See:
(static) Purchase
Renders the page to purchase a gift certificate.
- Source:
- See:
(static) ShowMiniCart
Renders the minicart.
- Source:
- See:
(static) Update
Updates the gift certificate in the basket.
- Source:
- See:
Methods
(inner) addToBasket()
Adds a gift certificate to the basket. This is called when the giftcert.purchase form is posted in the giftcertpurchase.isml template.
(inner) checkBalance()
Displays the details of a gift certificate as a JSON object in order to check the current balance. If an error occurs, renders an error message.
(inner) createGiftCert(cart) → {dw.order.GiftCertificateLineItem}
Creates a gift certificate in the customer basket using form input values. If a gift certificate is added to a product list, a ProductListItem is added, otherwise a GiftCertificateLineItem is added. Note: the form must be validated before this function is called.
Parameters:
Name | Type | Description |
---|---|---|
cart |
module:models/CartModel~CartModel |
A CartModel wrapping the current Basket. |
Returns:
gift certificate line item added to the current basket or product list.
(inner) edit()
Updates and renders the gift certificate purchase page. Clears the giftcert form and assigns values to the giftcert.purchase form from the gift certificate line item. Sets ContinueURL to GiftCert-Update and renders the gift certificate purchase page (checkout/giftcert/giftcertpurchase template). If there is no existing cart or no gift certificate line item, calls the purchase function.
(inner) processAddToBasket(action)
Internal helper function that creates/updates the gift certificate. Validates the giftcert.purchase form and handles any errors. Gets or creates a CartModel and creates or updates the gift certificate line item. It then recalculates the cart. For ajax requests, renders the checkout/giftcert/giftcertaddtobasketjson template. For all other requests, calls the Cart controller show function.
Parameters:
Name | Type | Description |
---|---|---|
action |
function |
The gift certificate function to execute. |
(inner) purchase()
Clears the giftcert form and calls the showPurchase function to render the page to purchase a gift certificate.
(inner) showError(args)
Internal helper to show errors on the purchase page. For an ajax request, renders a JSON object (checkout/giftcert/giftcertaddtobasketjson template). Otherwise, calls the showPurchase function.
Parameters:
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
args |
Object |
Properties
|
(inner) showMiniCart()
Gets the gift certificate line item and renders the minicart (checkout/cart/minicart) template.
- Source:
- To Do:
-
- Check why normal minicart cannot be used
(inner) showPurchase()
Internal helper function that prepares and shows the purchase page without clearing the form. Populates the giftcert.purchase with information from the httpParameterMap and the customer profile. Sets the ContinueURL to GiftCert-AddToBasket and renders the purchase page (checkout/giftcert/giftcertpurchase template).
(inner) update()
Updates the gift certificate in the basket. This is called when the giftcert.purchase is posted in the giftcertpurchase.isml template.
(inner) updateGiftCert(cart) → {dw.order.GiftCertificateLineItem}
Updates a gift certificate in the customer basket using form input values. Gets the input values from the purchase form and assigns them to the gift certificate line item. Note: the form must be validated before calling this function.
Parameters:
Name | Type | Description |
---|---|---|
cart |
module:models/CartModel~CartModel |
CartModel that wraps the current Basket. |
Returns:
gift certificate line item.