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, you need to 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_installdir/samples/Snippets/web/Marketing/Promotions
- WCDE_installdir\samples\Snippets\web\Marketing\Promotions
Prerequisites
Before customers can enter a promotion code, you must 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 your shopping cart page. If your 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_installdir\samples\Snippets\properties\Marketing\Promotions\MarketingJSPCodeSnippetText.properties
- WCDE_installdir\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_installdir\workspace\Stores\Web Content\WEB_INF\classes\ store\Snippets\Marketing\Promotionsor merge them with your own properties file and your error message properties file.