9 Replies Latest reply on Dec 4, 2012 4:21 PM by Obed Murillo

    Customize order level coupon and promotions


      Could anyone please suggest on where to customize to apply both order level coupons and promotions on the same order? When i apply an order level coupon, it over rides the existing order level promotion. I want to apply both on the same order

      for example, if i have 5% off on order total as promotion ( apply to order total), and i have 10% off on order total as a coupon, If i apply coupon, it over riding the 5% off promotion. I actually want to apply both on same order.

      i tried to change the qualifier filters filterForQualifierDiscountedByAnyDiscountId,filterForTargetDiscountedByAnyDiscountId,filterForTargetActedAsQualifierForAnyDiscount to false but still it doesnot help.

        • 1. Re: Customize order level coupon and promotions
          If you want to apply multiple promotions on same coupon, ATG 10 provides the capability of associating more than one promotions to a coupon.
          • 2. Re: Customize order level coupon and promotions
            There is no restriction on how many promotions can be applied to an order. People often use the terms coupon and promotion interchangeably, but they are different things in ATG. Promotions affect pricing. Promotions can be global, meaning they can apply to all orders, or non-global, meaning they must be granted explicitly to individual shoppers before they can be applied to those shoppers' orders. When a user claims a coupon, the coupons' promotion is granted to the user. The coupon does not affect pricing directly.

            The Commerce Reference Store (CRS) has a feature that prevents a shopper from applying more than one coupon-granted promotion to an order. When a shopper claims a coupon, CRS unclaims any previously-claimed coupon that was used for the current order.

            Are you using CRS? Are your promotions global or must they be granted? Did you get the 5% off promotion by claiming a coupon? If you answered yes, granted, and yes, then the behavior you described is what I would expect. If that's not the behavior you want, you can change or remove the CRS feature that limits coupons.
            • 3. Re: Customize order level coupon and promotions
              Obed Murillo
              Hi ClareR,

              Do you know where I can change the CRS feature to use more than one coupon?

              I am using CRS as base code and I am not able to claim more than 1 promotion at item level.

              • 4. Re: Customize order level coupon and promotions
                The answer depends somewhat on what release of ATG and CRS you're using. The CRS code that removes one coupon when another is submitted lives in the tenderCoupon method in atg.projects.store.order.purchase.StorePurchaseProcessHelper in the EStore module (component /atg/commerce/order/purchase/PurchaseProcessHelper). You can look at the source code and customize the code to do as much or as little as you like. You would still need to claim the new coupon, so overriding tenderCoupon with a completely empty method would probably not do what you want. tenderCoupon is called by a handful of CRS form handlers, anywhere CRS accepts a coupon code from a shopper. I didn't do an exhaustive search of the CRS code base. There may be other areas that need to be altered to remove the CRS restriction. For example, I could imagine a processOrder pipeline element that validates the number of coupons on a order before it's submitted. Check the CRS documentation to see if it gives you any more guidance.

                Starting in 10.1, ATG added a feature to the DCS (core Commerce) module in the platform that manages the number of coupons any shopper can claim at one time. The platform feature lives in /atg/commerce/claimable/ClaimableManager. CRS configures the maxCouponsPerProfile to 1. If you're using 10.1, you would probably want to reconfigure the property back to its default value of -1, meaning there's no limit on the number of coupons a shopper can claim.
                • 5. Re: Customize order level coupon and promotions
                  Obed Murillo
                  Thanks ClareR,

                  But I do not have tendeCoupon inside atg.projects.store.order.purchase.StorePurchaseProcessHelper. however there must be another code that just apply one coupon at the time for commerce Item, I created custom code to add the promotion manually but somehow after the claimCoupon method that I created is executed it does remove the adjustment that I just created.

                  Any other suggestion?

                  And yes, I found that ATG10.1 already has a solution for this is at here http://docs.oracle.com/cd/E24152_01/Platform.10-1/ATGMerchandisingUserGuide/html/s1409managingpromotionswithstackingru01.html just in case.

                  • 6. Re: Customize order level coupon and promotions
                    What release of CRS are you looking at? I found tenderCoupon in 10.0 and 10.1. Maybe the code was somewhere else in 9.x.

                    Stacking rules have nothing to do with coupons. They apply to promotions, which may or may not be attached to coupons. Stacking rules allow business users to designate groups of promotions that are mutually exclusive (cannot be applied together). There are also options to designate exceptions to the exclusions. The stacking rule feature was designed to give business users better control over reducing the number of promotions applied to any order. You sound like to want to expand the number of promotions applied, not reduce it. If you don't create any stacking rules, the DCS default behavior has no limit on the number of promotions that can be applied to one order.

                    By default, there are limitations for item promotions as to whether a single item (actually, an individual quantity of an item) can be discounted by more than one promotion and whether a single item can function as a qualifier for more than one promotion. Those limitations are controlled by the filter* flags you mentioned in your original post.

                    The upshot of all this is that there are many separate features that control which discounts apply to which items in an order. I haven't even mentioned all of them (for example some multisite features). I'm sure there's some debug logging that can provide clues about your particular set of coupons and promotions. The first step is to figure out whether one coupon claim is knocking out an earlier claim at the profile level (CRS's feature) or whether both promotions are available on the profile but not being applied to one order together.
                    • 7. Re: Customize order level coupon and promotions
                      Obed Murillo
                      I have installed CommerceReferenceStore@9.1 but my ATG is 10.0.3

                      Indeed the profile and the order has the coupon, but the promotion of the coupon is not being applied to the items.

                      What I want to accomplish is the following:

                      There is a promotion that will allow customers that are company employees have a 25% discount on each item, but they also can add coupon codes that are a promotion at item level, so when I try to add the coupon is not being added as promotion (I cant see any adjustment for it on the commerce item price info object).

                      I had tried several things, but I am not able to find yet where is the code that allows the order just have one discount at item level.

                      Your suggestion of CRS having that is help but I am still looking on it

                      • 8. Re: Customize order level coupon and promotions
                        How do employees get access to the employee discount? One choice is that you have code somewhere that grants the promotion to every employee so it's always available in their profiles. A much less convenient choice is that each employee has to claim a coupon as an employee. If your case is anything other than the coupon choice, then CRS has nothing to do with the behavior you're seeing. It sounds like you're running into the default DCS behavior that says that no item can be discounted by multiple promotions.

                        The 10.1 stacking rule feature would solve your problem. I don't recommend trying to implement stacking rules yourself. It's a complicated feature. If upgrading to 10.1 is not an option, your choices are to reconfigure or customize the Qualifier Service. Take a look at the "Overriding Qualifier Filters" section in the ATG Commerce Programming Guide.
                        • 9. Re: Customize order level coupon and promotions
                          Obed Murillo
                          Hi ClareR,

                          I was writing custom code to stack, now with your suggestion I am able to acomplish what I was looking for.

                          For reference to other users with the same problem the documentation is at http://docs.oracle.com/cd/E24152_01/Platform.10-1/ATGCommProgGuide/html/s1102overridingqualifierfilters01.html

                          Thank you ClareR I really appreciate it.