Every time I update Magento I have got this probem: I have to manually applicate the catalog price rule, otherwise they don't work.
I have done the following changes:
File app/Mage.php
:
date_default_timezone_set('Europe/Rome');//Instead of UTC
File Mage/CatalogRule/Model/Action/Index/Refresh.php
(local copy and none):
$timestamp = $coreDate->gmtTimestamp('Today');
with this line:
$timestamp = Mage::app()->getLocale()->date(null, null, null, true)->get(Zend_Date::TIMESTAMP);
Source: https://stackoverflow.com/questions/25280095/magento-catalog-price-rule-disappears-at-night
Reading this question: Catalog price rule from today does not apply
The time zone set inSystem/Configuration/Genral/Locale options
is correct, but if I run this script:
include('app/Mage.php');
Mage::app('admin');
echo date('Ymd His', Mage::getModel('core/date')->gmtTimestamp('today'));
it output 2015-11-07 23:00:00
instead of 2015-11-08 11:19:ss
, basically a gap of twelve hours.
Cron Job Setting
File: /app/code/core/Mage/CatalogRule/etc/congif.xml
<jobs>
<catalogrule_apply_all>
<schedule>
<cron_expr>0 1 * * *</cron_expr>
</schedule>
<run>
<model>catalogrule/observer::dailyCatalogUpdate</model>
</run>
</catalogrule_apply_all>
</jobs>
File /app/code/core/Mage/Catalog/etc/config.xml
<jobs>
<catalog_product_index_price_reindex_all>
<schedule>
<cron_expr>0 2 * * *</cron_expr>
</schedule>
<run>
<model>catalog/observer::reindexProductPrices</model>
</run>
</catalog_product_index_price_reindex_all>
</jobs>
Value in cronjob setting:
EDIT
Using this:
date("Y-m-d H:i:s", Mage::getModel('core/date')->timestamp(time()));
it outputs the time without considering the daylight save, basically one hour in advance
EDIT 2
Reverting the changes in app/Mage.php
: has solved the daylight save problem