Could any one help me? I would like to accept coupon codes without checking case, so that for example 'Eu15', 'eu15' and 'EU15' would all be accepted as 'EU15' coupon code.
Presently (OpenCart 1.4.9.3) coupon codes are subject to case verification. How do I bypass this?
Thanks in advance,
Gary
edit: catalog/model/checkout/coupon.php
find
Code: Select all
$coupon_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "coupon c LEFT JOIN " . DB_PREFIX . "coupon_description cd ON (c.coupon_id = cd.coupon_id) WHERE cd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND c.code = '" . $this->db->escape($coupon) . "' AND ((date_start = '0000-00-00' OR date_start < NOW()) AND (date_end = '0000-00-00' OR date_end > NOW())) AND c.status = '1'");
Code: Select all
$coupon_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "coupon c LEFT JOIN " . DB_PREFIX . "coupon_description cd ON (c.coupon_id = cd.coupon_id) WHERE cd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND LCASE(c.code) = '" . $this->db->escape(strtolower($coupon)) . "' AND ((date_start = '0000-00-00' OR date_start < NOW()) AND (date_end = '0000-00-00' OR date_end > NOW())) AND c.status = '1'");
See my BUG report: Vouchercode is case sensative + you can create 2 vouchers with same code when using upper or lowercase
Norman in 't Veldt
Moderator OpenCart Forums
_________________ READ and Search BEFORE POSTING _________________
Our FREE search: Find your answer FAST!.
[How to] BTW + Verzend + betaal setup.
Allthough I guess this could be classed as a bug, I doubt anyone would create two vouchers in this wayi2Paq wrote:It is even worse!
See my BUG report: Vouchercode is case sensative + you can create 2 vouchers with same code when using upper or lowercase
This isn't a bug, it is a feature.i2Paq wrote:It is even worse!
See my BUG report: Vouchercode is case sensative + you can create 2 vouchers with same code when using upper or lowercase
Coupon codes should always be case sensitive IMO
But an option for case-sensitivity can be added .
OK, an option to set the case sensitive would doQphoria wrote:This isn't a bug, it is a feature.i2Paq wrote:It is even worse!
See my BUG report: Vouchercode is case sensative + you can create 2 vouchers with same code when using upper or lowercase
Coupon codes should always be case sensitive IMO
But an option for case-sensitivity can be added .

Norman in 't Veldt
Moderator OpenCart Forums
_________________ READ and Search BEFORE POSTING _________________
Our FREE search: Find your answer FAST!.
[How to] BTW + Verzend + betaal setup.
In (catalog\model\checkout\coupon.php) at approx line 6, make the following highlighted changes:
Highlights:
$coupon_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "coupon WHERE UCASE(code) = '" . $this->db->escape(strtoupper($code)) . "' AND ((date_start = '0000-00-00' OR date_start < NOW()) AND (date_end = '0000-00-00' OR date_end > NOW())) AND status = '1'");
Code:
Code: Select all
$coupon_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "coupon WHERE [b][highlight]UCASE(code)[/highlight] [/b]= '" . $this->db->escape([b][highlight]strtoupper($code)[/highlight][/b]) . "' AND ((date_start = '0000-00-00' OR date_start < NOW()) AND (date_end = '0000-00-00' OR date_end > NOW())) AND status = '1'");
Never lose data again! Use Dropbox - DO THIS BEFORE YOU SIGNUP for Extra Space!!
http://db.tt/inKP3mv Signing up via this link gives you a bonus of 256 MB
More Bonuses: http://www.dropbox.com/free .5 GB
http://www.dropbox.com/edu = double your bonus referrals by giving an edu address.
Total ~ 3gb
Users browsing this forum: No registered users and 91 guests