Post by wal_j » Fri Sep 04, 2009 11:54 pm

The coupon start date has an error in it,

If the coupon start date is set at "2009-09-04" then the coupon is not able to be used until tomorrow "2009-09-05".

This is due to the SQL looking for coupons less than NOW() when NOW() of course is today.

catalog/model/checkout/coupon.php
Line 6

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->language->getId() . "' AND c.code = '" . $this->db->escape($coupon) . "' AND c.date_start < NOW() AND c.date_end > NOW() AND c.status = '1'");
Replace with

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->language->getId() . "' AND c.code = '" . $this->db->escape($coupon) . "' AND c.date_start <= NOW() AND c.date_end > NOW() AND c.status = '1'");
Only added "=" after $this->db->escape($coupon) . "' AND c.date_start <

Alex

New member

Posts

Joined
Tue May 12, 2009 11:51 pm
Who is online

Users browsing this forum: No registered users and 13 guests