JSP code snippet: Promotion code form
This JSP code snippet displays the following information: the order list and the discounts applied, the promotion code form that allows customers to enter a promotion code, the list of promotion codes entered (for each code, a 'Remove' button is provided to allow customers to remove the code).
This snippet assumes that the promotion code form is in the shopping cart page. If the promotion code form is not in the shopping cart page, change the values for parameter 'URL' and 'errorViewName' accordingly. More information is provided in the JSP comments.
The PromotionCodeForm.jsp file is available under the following directory:
- WC_INSTALL/samples/Snippets/web/Marketing/Promotions
- WCDE_INSTALL\samples\Snippets\web\Marketing\Promotions
Prerequisites
Before customers can enter a promotion code, create a promotion with a corresponding promotion code, using the WebSphere Commerce Accelerator.
Usage
To use this snippet, you can cut and paste the code from the snippet to the shopping cart page. If the store page is based on the consumer direct sample store, the JSP file for the shopping cart is OrderItemDisplay.jsp.
The two properties files used by this snippet are:
- WCDE_INSTALL\samples\Snippets\properties\Marketing\Promotions\MarketingJSPCodeSnippetText.properties
- WCDE_INSTALL\samples\Snippets\properties\Marketing\Promotions\MarketingJSPCodeSnippetErrorMessages.properties (used for error handling)
You may want to copy the properties to the proper location, for example, WCDE_INSTALL\workspace\Stores\Web Content\WEB_INF\classes\ store\Snippets\Marketing\Promotions
or merge them with the own properties file and the error message properties file.
Related concepts
Related tasks
Activating or deactivating a promotion
Related information
Tutorial: Customizing the consumer direct sample store using snippets