Developer forum

Forum » Rapido » Order Discount

Order Discount

Søren Bremholm Jakobsen
Reply

Hi,

Regarding Order Discounts vs. Vouchers. When applying order discount codes to a sales order in the shopping cart we get an error message that the voucher code is not applied even though that the discount actually is provided to the order (see attached screen dump). The problem as I see it is that the code is checking for vouchers and the order discount id isn't found in the voucherlist. The same code is used if you type in an invalid order discount code. Any input?

foreach (string code in codes)
                    {
                        Voucher vouch = Voucher.GetVoucherByCode(code);
                        if (vouch == null)
                        {
                            errors.Add(Translate("Voucher") + " <span class=u-bold>" + code + "</span> " + Translate("not found"));
                            continue;
                        }
                        if (vouch.DateUsed.HasValue)
                        {
                            errors.Add(Translate("Voucher") + " <span class=u-bold>" + code + "</span> " + Translate("already used"));
                            continue;
                        }
                        VoucherList voucherList = VoucherList.GetListById(vouch.ListId);
                        if (!voucherList.ListActive)
                        {
                            errors.Add(Translate("Voucher") + " <span class=u-bold>" + code + "</span> " + Translate("is not active"));
                            continue;
                        }
                        // EGWBP.VIKING SOBJA - change translate
                        <div class="field-success u-margin-bottom dw-mod">@Translate("Voucher code") <span class="u-bold">@code</span> @Translate("applied to order")</div>
                    }

                    foreach (string error in errors)
                    {
                        <div class="field-error u-margin-bottom dw-mod">@error</div>
                    }

 

2018-11-06_15_47_58-Betaling___Vikingfootwear.com.png

Replies

 
Nicolai Pedersen
Reply

Hi Søren

Yes, the above code expects you to use voucher lists. I have no quick solution to it - except use voucherlists instead of hardcoded voucher codes directly on the discount. I'll send this to QA and they can decide what should happen.

Sorry about the inconvenience.

Nicolai

 
Olga Shedko Dynamicweb Employee
Olga Shedko
Reply

Hello,

This bug has already been solved within TFS # 57114.

Best regards,
Olga | QA
 
Søren Bremholm Jakobsen
Reply

Hi Olga,

Thanks for your reply. In which version will this be fixed? and is there any code snippet i can add to the cart template to temporarily fix this issue?

Best regards,

Søren

 
Olga Shedko Dynamicweb Employee
Olga Shedko
Reply
This post has been marked as an answer

Hi Søren,

This fix will be available in the next Rapido hot-fix release. 

To temporary fix the issue you can see attachment (or go to TFS # 57114 > Links > Changeset 72212 > Compare to previous version).

Best regards,

Olga | QA

 

Changeset_72212.png
Votes for this answer: 1
 
Søren Bremholm Jakobsen
Reply

Much appreciated. Thanks

 

You must be logged in to post in the forum