7

I have a catalog price rule for a group of products with start date 25/06/14 and end date 30/06/14. This rule stops working at midnight 29/06/14. This happens every weekend for campaigns that should be available until monday evening. Cron is running every minute. Anyone have a clue why they stop working a day in advance?

4

I had a lot of issues with the catalog price rules reindexing before.
My latest solution (that seams to work) was to change the hour when the cron for reindexing of catalog rules run.
Here is why.
I'm using a time zone with GMT+2.
The default cron is set to run at 1.00.
So I put a log to see when the cron starts and when it ends.
My surprise was to see the following:

2014-06-06T23:00:02+00:00 DEBUG (7): Start daily update
2014-06-06T23:00:05+00:00 DEBUG (7): End daily update

So the hour that was logged was the GMT hour (23.00).
And the cron calculates the dates to for which the reindex should be done like this:

$fromDate = mktime(0,0,0,date('m'),date('d')-1); 

So it does not use the internal date methods but directy date I thought it may have something to do with timezone settings.
So I made the cron run at one hour when my timezone and GMT timezone are in the same day.
Moved it to 2:10.
I didn't have any issues since then.

  • hi @marius , check here : prntscr.com/7535c7 also i am using time zone with GMT + 5:30 and i did't gave any date in catalog price rules. so what i have to do to get solution? – Baby in Magento May 14 '15 at 12:31
  • can you please inform me in which file and path you changed that code? – Baby in Magento May 14 '15 at 12:47
  • 1
    @BabyinMagento2.The file that determines when the cron runs is app/code/core/Mage/CatalogRule/etc/config.xml Look for the line <cron_expr>0 1 * * *</cron_expr> – Marius May 14 '15 at 12:48
  • that's fine, i got the line, where i have to add it this code :" $fromDate = mktime(0,0,0,date('m'),date('d')-1);" or what changes i have to do now ? – Baby in Magento May 14 '15 at 12:54
  • 1
    you don't need to add that line anywhere – Marius May 14 '15 at 12:57
1

Technically it is ending at 00:00:00 30/06/14. Try adding a time to the datetime string in that format, or bumping the day up by one. Simply setting the end date to 30/06/14 tells the system to end the promotion the minute after 23:59:00 29/06/14, which is the first minute (00:00:00) of 30/06/14.

1

Change timezone in configuration to GMT. Apply the catalog rules now.

Revert back timezone to your desired selection if needed. I have a fashion store www.huzoorwomen.com that uses same rules.

0

Try setting your Default Store Timezone to match your server timezone.

enter image description here

enter image description here

0

I had this problem as well, the issue exists when there is an offset of the local timezone greater than +01:00.

Basically just because magento is using the gmtTimestamp for the rule date which in the above stated case results in the day before today.

Therefor I developed a small module https://github.com/Chuvisco88/Chuvisco_CatalogRuleFix to fix the issue. If someone ever has this problem, please give it a try.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.