1 2 Previous Next 16 Replies Latest reply on Nov 20, 2012 12:42 PM by 877508 Go to original post
      • 15. Re: Many coupons in order
        Unfortunately, after override method claimCoupon() apply only first coupon code, not all. Are you have any ideas?

        Edited by: Yury Gerzhedovich on 19.11.2012 12:41
        • 16. Re: Many coupons in order
          The code should work with a small correction I think the problem is that the second coupon is not valid and is therfore ending the transaction can you check , over ride claimCouponMethod in CouponFormHandler and write your own logic , you can obtain the coupons entered by the user and split them based on your delimiter.

          Also after you apply each coupon to the order by invoking claimCoupon method in ClaimableManager , do remember to reprice the oder and also update the order within a transaction block.
          You can also add the coupons which were not applied on the order ( may be due to conditions not matching , or non elgibility ) by checking the promodiscount amount on the order by iterating the commerce items (by getting the information from adjustments ).

          This could be a possible code block

          String[] coupons = inputCoupons.split("delimier used);
          //Begin Transaction
          for( String couponId:coupons){
          //get Coupons item

          //Begin Transaction


          //End Transaction

          //reprice the order using the pricing method chosen ( order_subtotal hencceforth)

          //update the order

          //end transaction

          by using a independent inner transaction , you can stop the entire transaction from being rolled back .

          Sundar M R

          Edited by: Sundar on Nov 20, 2012 2:56 AM
          1 person found this helpful
          1 2 Previous Next