9 Replies Latest reply on Jul 26, 2013 10:15 AM by user10808089

    Applying discounts of disabled coupons


      There's a problem where discount coupons are attached to a user profile, and even that they are disabled (promotion disabled), the discount of these coupons is being applied in the order finish.
      This happens, even if other coupon is informed for the refered order, applying the discount of both coupons, the one informed in the order and the other that is attached to the user profile.

      Is there any way to remove the disabled coupons? Also, does anyone know why is this happening?

      Renã Treto.
        • 1. Re: Applying discounts of disabled coupons
          Obed Murillo
          you can do this on the commitOrder transaction:

                    //Clean user activeCodes
                    MutableRepositoryItem profile = (MutableRepositoryItem) getProfile();
                    profile.setPropertyValue("activePromotions", null);

          This will remove the active promotions on the profile.

          I am not sure if that is what you are looking for.

          • 2. Re: Applying discounts of disabled coupons
            karthik chopperla
            Coupon disabling wont help if promotion is already in user profile list of promotions. You mentioned that the promotion is disabled, then you need to check if the order discounted is based on the same promotion.

            To verify, print all promotions applied on order and item by iterating through Order's pricingAdjustments, and individual item's pricingAdjustments in the cart page.

            OrderImpl order = getCurrent();
            OrderPriceInfo opi = order.getPriceInfo
            List pricingAdjustments = opi.getPricingAdjustments()
            for (each pricingAdjustment) {
            Get promotion id from pricing adjustment

            List commerceItems = order.getCommerceItems()
            for(each commerceItem){

            Get ItemPriceInfo from commerceItem
            get pricing adjustment from Item price info
            Get promotion id

            • 3. Re: Applying discounts of disabled coupons
              Another good idea will be add a processor in "processOrder" chain of commerce pipeline , i the processor , do the checks as needed and remove the promotions from users active promotions property which are not used in current order , so next time users comes to website with new order , he wont be getting promotions which you disabled later.

              • 5. Re: Applying discounts of disabled coupons

                The problem is that this does not occur with new orders. It happens when a promotion coupon is added to an order and the order is not finished. And after some time, it is added a new coupon promotion to the same order, applying the discounts from both the old and the new coupon.

                Is there anything to do regarding this matter?

                Renã Treto

                Edited by: rtreto on 07/12/2012 03:32

                Edited by: rtreto on 11/12/2012 05:12
                • 6. Re: Applying discounts of disabled coupons
                  Kumaresh Babu

                  just clean up your catalog reposiory.

                  hope tis will solve

                  • 7. Re: Applying discounts of disabled coupons
                    Any idea?

                    Edited by: rtreto on 18/12/2012 10:17
                    • 8. Re: Applying discounts of disabled coupons
                      Hi Renã,

                      If the promotion is disabled it should not have been applied to order on repricing after application of second coupon.
                      If it is an issue you can keep a check for enabled property in your ItemDiscountCalculator and OrderDiscountCalculator.

                      • 9. Re: Applying discounts of disabled coupons

                        If I understand correctly, it seems like you are manually calculating the tax and entering it to the invoice amount. If you configure your taxes in Oracle, and then enter the invoice for the actual amount, then Oracle will know the true invoice amount which is the discount basis and create the tax line according to the configurations (the way you want it). What you are doing now is adding the tax outside Apps configuration and then expecting Apps to calculate the appropriate discount. If you want to use the standard functionality, you need to set up all dependent parts of that functionality. If tax calculation is a dependency of the discount basis, which is certainly a dependency of discount coupons payment terms, then you need to set it up properly.