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.

  • Jais Edelmann 45 posts 126 karma points
    Aug 24, 2012 @ 10:56
    Jais Edelmann
    0

    Voucher issue in 2.6.1.0

    Alright so i got my solution updated to 2.6.1.0 because i saw a lot of people with issues with vouchers in the older versions, however this didnt solve my problem for some reason.

     protected void btnVoucher_Click(object sender, EventArgs e)
     {
          VoucherCode vc = VoucherCode.SingleOrDefault(x => x.Code == tbVoucher.Text) ?? new VoucherCode();
          UCommerce.Xslt.Library.AddVoucher(tbVoucher.Text);
     }

    I used the VoucherCode just to check that it actually finds it and it does, but when i validate the voucher with this

    bool voucherOK = VoucherCodes.All().Any(x => x.Code == tbVoucher.Text && x.MaxUses > x.NumberUsed && x.VoucherTarget.CampaignItem.Campaign.Enabled && x.VoucherTarget.CampaignItem.Campaign.StartsOn >= DateTime.Now && x.VoucherTarget.CampaignItem.Campaign.EndsOn >= DateTime.Now)

    It doesent validate i've checked the parameters in the backend and everything should be alright, i even created a few new to test. They are enabled and they are within date limits. So i'm not really sure why its not doing anything and not sure why it doesent validate :/

  • Søren Spelling Lund 1797 posts 2786 karma points
    Aug 24, 2012 @ 11:06
    Søren Spelling Lund
    0

    It's the code. The date range check is a bit off:

    bool voucherOK = VoucherCodes.All().Any(x => x.Code == tbVoucher.Text && x.MaxUses > x.NumberUsed && x.VoucherTarget.CampaignItem.Campaign.Enabled && x.VoucherTarget.CampaignItem.Campaign.StartsOn <= DateTime.Now && x.VoucherTarget.CampaignItem.Campaign.EndsOn >= DateTime.Now)

    I flipped the comparison to "less than" instead of "greater than".

  • Jais Edelmann 45 posts 126 karma points
    Aug 24, 2012 @ 11:09
    Jais Edelmann
    0

    Arh alright, but the method UCommerce.Xslt.Library.AddVoucher(string) still doesent do anything to my order, when i check my basket object i dont see the discount? :/

  • Søren Spelling Lund 1797 posts 2786 karma points
    Aug 24, 2012 @ 11:09
    Søren Spelling Lund
    0

    Did you run the basket pipeline afterwards?

  • Jais Edelmann 45 posts 126 karma points
    Aug 24, 2012 @ 11:17
    Jais Edelmann
    0

    Actually i just assumed the xslt library handled that for me so much for not paying for reflector after trial expired:) it works now awesomesauce!

    Thanks a bunch Søren, on a side node could you email me a free linces for a shop with instructions? ([email protected])

  • Søren Spelling Lund 1797 posts 2786 karma points
    Aug 29, 2012 @ 09:53
    Søren Spelling Lund
    0

    You can get a free license through the website at http://www.ucommerce.dk/en/products

    Just hit the download button under FREE.

Please Sign in or register to post replies

Write your reply to:

Draft