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.

  • Kim Søjborg Pedersen 71 posts 275 karma points
    Jun 27, 2013 @ 10:34
    Kim SĂžjborg Pedersen
    0

    Voucher code fra order

    I'm in this context at I need to output the Vouchercode if any used on the order, where can I find it?

    IEnumerable<PurchaseOrder> orders = new List<PurchaseOrder>();
    orders = PurchaseOrder.Find(x => x.OrderStatus.OrderStatusId == orderStatus);
    foreach (var order in orders)
    { //order.?
    foreach (var orderline in order.OrderLines)
    { //orderline.?
    }
    }
  • Nickolaj Lundgreen 233 posts 1132 karma points
    Jun 27, 2013 @ 10:40
    Nickolaj Lundgreen
    100
    public static IEnumerable<string> GetVouchers(this PurchaseOrder purchaseOrder)
            {
                var vouchers = purchaseOrder.OrderProperties.FirstOrDefault(x => x.Key == "voucherCodes");
                if (vouchers == null)
                {
                    return null;
                }
                else
                {
                    return vouchers.Value.Split(new[]{','}, StringSplitOptions.RemoveEmptyEntries);
                }
            }

    I have this extension lying around - hope its what you are looking for :)

Please Sign in or register to post replies

Write your reply to:

Draft