X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   General questions (X-Cart 5) (https://forum.x-cart.com/forumdisplay.php?f=66)
-   -   Case Insensitive Coupon Codes (https://forum.x-cart.com/showthread.php?t=76976)

CCP 05-24-2019 11:51 AM

Case Insensitive Coupon Codes
 
Is it possible to change Coupon codes to be case-insensitive?

We have a fair number of clients who complain that they can't enter the codes, when it turns out they aren't typing them in ALLCAPS.

pino_xcart 06-03-2019 08:20 AM

Re: Case Insensitive Coupon Codes
 
Hi,

The following patch should do the trick:

HTML Code:

Index: src/classes/XLite/Module/CDev/Coupons/Model/Repo/Coupon.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- src/classes/XLite/Module/CDev/Coupons/Model/Repo/Coupon.php    (revision 0ccac487726f63245ce987723148dcef1575ca44)
+++ src/classes/XLite/Module/CDev/Coupons/Model/Repo/Coupon.php    (date 1559578157000)
@@ -91,7 +91,7 @@
    protected function defineFindOneByCode($code)
    {
        $queryBuilder = $this->createQueryBuilder('c')
-            ->andWhere('COLLATE(c.code, utf8_bin) = :code')
+            ->andWhere('LOWER(COLLATE(c.code, utf8_bin)) = LOWER(:code)')
            ->setParameter('code', $code);
 
        return $queryBuilder;

Quote:

Originally Posted by CCP
Is it possible to change Coupon codes to be case-insensitive?

We have a fair number of clients who complain that they can't enter the codes, when it turns out they aren't typing them in ALLCAPS.



All times are GMT -8. The time now is 02:32 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.