Developer forum

Forum » Ecommerce - Standard features » Case sensitivity for voucher codes

Case sensitivity for voucher codes

Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Hi there,

Are voucher codes always case sensitive? And if so, is that a deliberate choice? And again, if so, what can I do to work around that? Is there an on before voucher code applied subscriber or similar where I can lower case the code and instruct the content managers to always use a lower case code, or better yet some OnValidate method that I can tap into and validate myself?

Thanks,

Imar


Replies

 
Nicolai Høeg Pedersen
Reply
This post has been marked as an answer

Can I suggest using

text-transform: lowercase or uppercase

In the input of your cart?

Votes for this answer: 1
 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Hi Nicolai,

I think that would work. Wat about the initial question: is this a deliberate design decision or would it make sense to have it case insensitive by default? I guess with the current setup you can have either by implementing your client side solution.

Imar

 
Nicolai Høeg Pedersen
Reply

Yes, we made this on UNIX, so thats how it is :-).

Looking at the code, it actually looks like it is not case sensitive. But it is a SQL against the database whith a simple where: SELECT * FROM EcomVouchers WHERE VoucherCode='{0}', so if the collation of the field is CS, the check will also be.

NP

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

It turns out it's not using the built-in vouchers, but an Order field discount with a selected Order field and a value set for the Order field value. In the customer's case, the coupon code is all caps but they want it to validate regardless casing. Looks like your client side solution is the way to go.

Still, it would be nice to make this case insensitive (or at least as an option) so content managers don't have to know what CSS is being applied to this field.

Thanks,

Imar

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

>> Looks like your client side solution is the way to go.

We implemented it like that (using text-transform) but it turns out that it is only a presentation feature, and doesn't affect the actual data. So something like this:

 <style>
.upper-case {
  text-transform: uppercase;
}
</style>

<input name="Field1" type="text" value="" id="Field1" class="upper-case" />

Looks great in the browser. When you type ddd you see it show up as DDD (as expected). However, on the server, it still ends up as ddd.

Short of replacing this with JavaScript on blur, are there other (Dynamicweb) options?

Imar

 
Nicolai Høeg Pedersen
Reply

Is it the OrderFieldShippingDiscount? - then I'll add an option to do the check case insensitive.

BR Nicolai

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

It's a custom order field (called SysCouponCode in our case) which is then selected as the Order field on a discount of type Order field discount using the "old" Sales discounts module.

Imar

 
Nicolai Høeg Pedersen
Reply

Great, TFS#22432 is coming up - 8.8.0.* ok?

NP

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Yep, great, no rush. For sites where I know this is an issue we put the JavaScript work around in place.

Thanks,

Imar

 
Kristian Kirkholt
Reply

Hi Imar

The feature TFS#22432 "Make the OrderFieldShippingDiscount able to compare case insensitive"  has now been fixed in version 8.8.0.6

You are able to find this build in the download section:

http://developer.dynamicweb-cms.com/downloads/dynamicweb-8.aspx

Please contact Dynamicweb Support if you need any additional help regarding this.

Kind Regards
Dynamicweb Support
Kristian Kirkholt

 
Scott Forsyth
Reply

I just ran into this too on 8.8.1.7. It's for the Discount matrix using a "Default Voucher Code Field". The Order field value is set to "FREESHIPPING", but fron the frontend, using 'freeshipping' doesn't work, but 'FREESHIPPING' does work.

Am I missing something, or does this situation also need to be updated to be case insensitive?

Thanks,

Scott

 
Nicolai Høeg Pedersen
Reply

Hi Scott

I've asked QA take a look at this.

 
Oleg Rodionov
Reply

Hi all,

I've checked the issue on last DW release. Yes, it's reproduced in fact for the both discount types and for loyalty points, new TFS 24835 has been submitted against the bug, thanls.

BR, Oleg QA 

 

You must be logged in to post in the forum