Copied to clipboard

Flag this post as spam?

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


  • René 327 posts 852 karma points
    Sep 30, 2014 @ 15:48
    René
    0

    Discount - Buy 10 get alternative price

    Hi 

    Umbraco 7  
    Teacommerce 2.3.2

    I need to calculate a new price on some of the products. 

    On the ducomenttype of the product i have a checkbox "addDiscount".

    When this is checked i shold use the price from a field "discountPrice"

    I have got the example from http://documentation.teacommerce.net/net-api/price-calculators/order-calculator/

    This part works. and i have got the discount added on all products.

    protected override Price CalculateOrderLineUnitPrice(OriginalUnitPrice originalUnitPrice, OrderLine orderLine, Currency currency, Order order)
            {
                //10% discount when buying 5 or more
                return new Price(orderLine.Quantity >= 10M ? originalUnitPrice.Value * 0.9M : originalUnitPrice.Value, orderLine.VatRate, currency);
            }

    If i could get a small hint in the direction of getting the property from the product "addDiscount"

    If this is checked use the "discountPrice" and return the new discountPrice. 

    This should only be for the orderline with the specifik product. Not the entire order

    René

  • Anders Burla 2560 posts 8256 karma points
    Oct 02, 2014 @ 16:07
    Anders Burla
    0

    If you add the property alias "addDiscount" to the "Product property aliases" in settings for the store. Then TC will copy that information to your order line and you now have it at orderLine.Properties["addDiscount"]

    Hope that helped

Please Sign in or register to post replies

Write your reply to:

Draft