Magento – Shouldn’t catalog price rule calculation always happen 3 days in advance

catalog-price-rulesmagento-1.7price-rules

We have simple catalog price rule which is valid indefinitely.

In our Google Shopping feed which is generated at midnight, the price rule does not apply.

My theory is, that there is a small time frame, where the calculated prices are not available.

I have checked catalogrule_product_price – there seem to be only prices calculated until today (2013-04-22), so they would expire at midnight:

mysql> select distinct rule_date from catalogrule_product_price;
+------------+
| rule_date  |
+------------+
| 2013-04-20 |
| 2013-04-21 |
| 2013-04-22 |
+------------+
3 rows in set (0.05 sec)

Is this normal?
cron_schedule has recent entries so I think the cron system is generally running.

I was having in mind, that price rules are always generated several days in advance, just to avoid such time spans with wrong prices – was I wrong with this assumption? What is going on here?

EDIT: checked it again today (2013-04-25) – same problem.
I wish I checked it yesterday to see if also 23.,24. and 25. where existing and so the prices are generated always in bunches or tree of if the prices are always generated until today and three days back.

mysql> select distinct rule_date from catalogrule_product_price;
+------------+
| rule_date  |
+------------+
| 2013-04-23 |
| 2013-04-24 |
| 2013-04-25 |
+------------+
3 rows in set (0.00 sec)

Best Answer

No.

The cron job calls the observer method Mage_CatalogRule_Model_Observer::dailyCatalogUpdate(). This one calls Mage_CatalogRule_Model_Resource_Rule::applyAllRulesForDateRange() without arguments.

If applyAllRulesForDateRange() is called without arguments, one day +/- the current date is assumed.

So you can create newer or older dates but the nightly cron job does not.

Related Topic