Claiming coupons is done via the /atg/commerce/promotions/CouponFormHandler
component. This component needs several properties set on a Java Server Page:
couponClaimCode
- the code to claim the couponclaimCouponSuccessURL
- the URL to go to on successful claimclaimCouponErrorURL
- the URL to go to on claim failure
After the user has typed in a coupon claim code, the FormHandler
attempts to claim it and add it to the user’s list of promotions. Here is the JSP that can be used to claim a coupon.
<dsp:form action="<%=form40%>" method="post"> <% /* Where to go to on success or failure */%> <dsp:input bean="CouponFormHandler.claimCouponSuccessURL" beanvalue="/OriginatingRequest.requestURI" type="hidden"/> <dsp:input bean="CouponFormHandler.claimCouponErrorURL" beanvalue="/OriginatingRequest.requestURI" type="hidden"/> <%/* Get the coupon claim code */%> Coupon code: <dsp:input bean="CouponFormHandler.couponClaimCode" type="text"/> <dsp:input bean="CouponFormHandler.claimCoupon" type="submit" value="Claim it"/> </dsp:form>