Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


These support forums are now closed for new topics and comments.
Please head on over to http://eureka.ucommerce.net/ for support.

  • Jason Mackay 98 posts 149 karma points
    Apr 16, 2012 @ 13:40
    Jason Mackay
    0

    Discounts in uCommerce

    Hi,

    I am working on the free version of uCommerce and set up my own voucher system, I can manage to get the discount showing up when I insert the right code, but cant get the Purchase Total to recalculate and subtract the money off.

    Does anyone know what has to be set here to do this?

    Thanks in advance.

    Jason

  • Søren Spelling Lund 1797 posts 2786 karma points
    Apr 16, 2012 @ 19:43
    Søren Spelling Lund
    0

    Are you executing the basket pipeline after you add the discount to the order? If there's a discount associated either at the order level or at both the order and line level uCommerce will figure in the AmountOff automatically.

  • Jason Mackay 98 posts 149 karma points
    Apr 17, 2012 @ 10:07
    Jason Mackay
    0

    Soren

    I have altered the basket pipelines and created a new class to look for the voucher code from the text field, I changed the Basket.ApplyAwards(I think it was called) and this class is called from there, but from here I cant get the Order Total to recalculate it with the discount added. The order level should be the level after this and it isnt having an effect.

    Thanks

    Jason

  • Søren Spelling Lund 1797 posts 2786 karma points
    Apr 24, 2012 @ 08:56
    Søren Spelling Lund
    0

    How are you adding the discount?

    Something like this?

    var discount = new Discount { AmounfOff = 100 };
    order.AddDiscount(discount);
  • Jason Mackay 98 posts 149 karma points
    Apr 24, 2012 @ 15:29
    Jason Mackay
    0

    Hi Soren

    None of this was working automatically. I had to bring in the CalculateOrderTotalTask and hardcode this to take the discount off the Order Total, this was the only way to do it. So I had to rewrite the pipelines and bring in serveral of the classes from the dll to get it to work.

    All working now though.

    Thanks

    Jason

  • Søren Spelling Lund 1797 posts 2786 karma points
    Apr 25, 2012 @ 09:58
    Søren Spelling Lund
    0

    The basket pipeline should take the discounts into account when recalculating.

    Which version are you on?

  • Cathy Pank 21 posts 41 karma points
    May 03, 2013 @ 12:31
    Cathy Pank
    0

    Hi Soren, just joining this thread. I am using uCommerce-3.5.0.13098. I am trying to do a similar thing using the code:

    var dis = new Discount { AmountOffTotal = discountValue.Value };
    basket.AddDiscount(dis);
    basket.Save();
    TransactionLibrary.ExecuteBasketPipeline();

    After I do basket.Save() I can see the discount listed in the Discounts but after I Execute the BasketPipeline the discounts are removed so not calculated.

    I have not customised the Basket Pipeline from the default so it has:

     

    <!-- Calculate order level discount total based on applied discounts -->
    <value>${Basket.CalculateOrderLinesUnitDiscounts}</value>
    <!-- Calculcate order line discounts based on applied discounts --> 
    <value>${Basket.CalculateOrderDiscount}</value>
    <value>${Basket.CalculateOrderLinesDiscounts}</value>
    

     

     

  • Cathy Pank 21 posts 41 karma points
    May 03, 2013 @ 12:41
    Cathy Pank
    0

    Actually I just solved it using your tip from here: http://our.umbraco.org/projects/website-utilities/ucommerce/ucommerce-support/24893-Apply-voucher-code-programatically . Commented out the <value>${Basket.ApplyAwards}</value> from the pipeline and its all great!

Please Sign in or register to post replies

Write your reply to:

Draft