Coupon

ATG Commerce provides the ability to create and manage gift certificates and coupons. (Collectively,
referred to as “claimable items” in ATG Commerce.)

The claimable item system in ATG Commerce is made up of three components:

  • Claimable repository
  • ClaimableTools component
  • ClaimableManager component



Claimable Repository


The Claimable repository holds all possible claimable items, namely, gift certificates and coupons .

<item-descriptor name="claimable" sub-type-property="type" version-property="version">
    <property name="type" data-type="enumerated">
      <option value="GiftCertificateClaimable"/>
      <option value="PromotionClaimable"/>
      <option value="CouponBatch"/>
      <option value="BatchPromotionClaimable"/>
    </property>
</item-descriptor>

Component having IdGenerator=/atg/dynamo/service/ObfuscatedIdGenerator -  creates nonsequential repositoryId values, prevent users from guessing claim codes.


ClaimableTools

            /atg/commerce/claimable/ClaimableTools

ClaimableTools.caseInsensitiveClaimableIds property determines whether coupon IDs are case-sensitive or not
ClaimableTools component is to provide configurable values for the various properties of claimable items.

ClaimableManager

            /atg/commerce/claimable/ClaimableManager

It provides the ability to claim items, initialize them, and then perform functions that are specific to one type of claimable item

ClaimableManager component provides are as follows

  • createClaimableGiftCertificate
  • debitClaimableGiftCertificate
  • creditClaimableGiftCertificate


maxCouponsPerProfile property sets the maximum number of coupons a customer can use per order. The default is -1, which allows unlimited coupon uses.

ClaimableManager.claimCoupon() method checks to see if the coupon claim limit has been reached, how many coupons are on the customer’s profile, and whether those coupons are valid for the current site. If the limit has not been reached, claiming proceeds as normal.

If the limit has been reached, two behaviors are available. The ClaimableManager.validMaxCouponLimitReachedActions property can be set to either of the following values:

  • throwException
  • removeLRU


Tracking Coupon-Adjusted Promotions


The pricing process creates a pricingAdjustment object, which stores the promotion that caused the adjustment. The coupon property of the pricingAdjustment stores the coupon that resulted in the adjustment.

The ProcUpdateAdjustmentsWithCoupon pipeline processor iterates through the pricing adjustments on the order and pulls the first coupon related to the promotion from the promotionStatus matching on the promotion. This processor runs before the ProcRemoveUnusedPromotions pipeline processor in the processOrder pipeline chain.



Removing Unused Coupon-Based Promotions

To enable unused coupon removal, set the removeUnusedCouponBasedPromotions property of the RemoveUnusedPromotions component to true. The default is false. If set to true, the ProcRemoveUnusedPromotions pipeline processor in the processOrder pipeline chain looks at each promotion’s status and removes promotions that meet all of the following criteria:

  • Created as a result of a coupon claim
  • Single-use
  • Has not been used
  • Start date is before the current date



Claiming a coupon in Cart :

<dsp:form method="post">

          <!-- Get the coupon claim code -->
          Coupon code: <dsp:input bean="CouponFormHandler.couponClaimCode" type="text"/>

          <dsp:input bean="CouponFormHandler.claimCoupon" type="submit"/>

</dsp:form>


Adds the gift certificate to the customer’s order and prompts him or her to specify the e-mail address of the recipient:


<dsp:form action="<%=request.getServletPath()%>" method="post">

    <dsp:input bean="ShoppingCartModifier.ProductId" paramvalue="Product.repositoryId" type="hidden"/>
    <dsp:input bean="ShoppingCartModifier.catalogRefIds" paramvalue="Sku.repositoryID" type="hidden"/>

Recipient's e-mail address
    <dsp:input bean="ShoppingCartModifier.softGoodRecipientEmailAddress"/>

<!-- ADD TO CART BUTTON: Adds this SKU to the Order-->
    <dsp:input bean="ShoppingCartModifier.addSoftGoodToOrder" value=" Add Gift Certificate to Cart " type="submit"/> 

<!-- Goto this URL if NO errors are found during the ADD TO CART button processing:-->
    <dsp:input bean="ShoppingCartModifier.addSoftGoodToOrderSuccessURL" value="../checkout/cart.jsp" type="hidden"/>
    <dsp:input bean="ShoppingCartModifier.addSoftGoodToOrderErrorURL" value="product_gift_certificate.jsp" type="hidden"/>


</dsp:form>

No comments :