Post by Rainforest » Sat Nov 16, 2024 4:59 am

We had a coupon code running from November 12 - November 16
Working fine for the most part.
Then we ran into an issue with a client's order changing hte status to complete. It would go to Cancelled.

I figure it was either the fraud thing or a coupon issue.
Well, I went on the front end as a guest and tried the coupon which was set to expire the next day and got the dreaded:

warning: Coupon is either invalid, expired or reached its usage limit! opencart

I extended the coupon date again (for uses we have 999 and 999...so really unlimited use)
Still the coupon didn't work.
I deleted the coupon and added it again then it worked.

Any ideas what causes this?

OC 3.0.4.0

Self Taught Opencart User & Developer Since 2010.


User avatar
Active Member

Posts

Joined
Fri Jan 28, 2011 3:50 am

Post by by mona » Sat Nov 16, 2024 6:32 am

Set it to start one day before and to end one day after and see if that solves the problem.

The code is

Code: Select all

$coupon_query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "coupon` WHERE code = '" . $this->db->escape($code) . "' AND ((date_start = '0000-00-00' OR date_start < NOW()) AND (date_end = '0000-00-00' OR date_end > NOW())) AND status = '1'");
and maybe you are expecting it to be

Code: Select all

$coupon_query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "coupon` WHERE code = '" . $this->db->escape($code) . "' AND ((date_start = '0000-00-00' OR date_start <= NOW()) AND (date_end = '0000-00-00' OR date_end >= NOW())) AND status = '1'");

DISCLAIMER:
You should not modify core files .. if you would like to donate a cup of coffee I will write it in a modification for you.


https://www.youtube.com/watch?v=zXIxDoCRc84


User avatar
Expert Member

Posts

Joined
Mon Jun 10, 2019 9:31 am

Post by Rainforest » Sat Nov 16, 2024 7:03 pm

Thanks for the suggestion, Mona.

We normally put the coupon to start 1 day before and 1 day after normally. We do this because I think our server time is a few hours ahead of our time so in the past the coupon has expired when put on the actual end date.

Very weird situation that I'll have to monitor especially with holiday sales coming up.

Self Taught Opencart User & Developer Since 2010.


User avatar
Active Member

Posts

Joined
Fri Jan 28, 2011 3:50 am

Post by by mona » Sat Nov 16, 2024 8:09 pm

Maybe you have a situation like this ?
https://www.opencart.com/index.php?rout ... n_id=40580

DISCLAIMER:
You should not modify core files .. if you would like to donate a cup of coffee I will write it in a modification for you.


https://www.youtube.com/watch?v=zXIxDoCRc84


User avatar
Expert Member

Posts

Joined
Mon Jun 10, 2019 9:31 am

Post by Rainforest » Mon Nov 18, 2024 6:53 pm

by mona wrote:
Sat Nov 16, 2024 8:09 pm
Maybe you have a situation like this ?
https://www.opencart.com/index.php?rout ... n_id=40580
possible. That is for 2.3.0.2. Not sure if it will work for 3.0.4.0 but will see on my developer server.

Thank you for the suggestion

Self Taught Opencart User & Developer Since 2010.


User avatar
Active Member

Posts

Joined
Fri Jan 28, 2011 3:50 am
Who is online

Users browsing this forum: Bing [Bot] and 25 guests