Totally Zenned
- Join Date:
- Apr 2007
- Location:
- Herts. UK
- Posts:
- 893
- Plugin Contributions:
- 0
Post #1 by cjpinder
Hi,
On the day of the end date of a sale created with salemaker, Zen Cart will turn the sale repeatedly on and off every time a page is loaded in Admin. This can lead to excessive server load.
The problem seems to be that zen_expire_salemaker() and zen_start_salemaker() in includes/functions/salemaker.php do not agree on what the end date should be.
I've seen this with Zen Cart v1.3.7 / v1.3.8, PHP 5 and MySQL 4.
I would suggest making following change to zen_start_salemaker() ...
$salemaker_query = "select sale_id
from " . TABLE_SALEMAKER_SALES . "
where sale_status = '0'
and (((sale_date_start <= curdate() and sale_date_start != '0001-01-01') and (sale_date_end > curdate()))
or ((sale_date_start <= curdate() and sale_date_start != '0001-01-01') and (sale_date_end = '0001-01-01'))
or (sale_date_start = '0001-01-01' and sale_date_end > curdate()))
";
```The above code changes two of the >= operators to > to fix the bug and for forwards compatibility changes now() to curdate(). The zen_expire_salemaker() function should probably also be changed to use curdate() instead of now() to prevent issues with MySQL 5 compatibility.
Regards,
Christian.