1

We have disabled catalogrule_apply_all Magento cronjob, because of multi-environment system (to simplify things: let's say we have 1 staging server & 1 production server) in one of our customer. Catalogrule refresh process is done only in one environment (staging), and then we pass database data through a system process from that environment to others (production)

Problem is we have some days when we don't pass data between environments, and then the catalogrule refresh is not executed, but Magento does the reset in production environment.

Somebody here know which concrete Magento cron task does that daily reset? Or maybe this is not done by any cronjob, so the problem is the catalogrule refresh is simply required to be executed every day, even if there aren't any changes in active catalogrule rules?

UPDATE I suspect this is the cause, can somebody confirm that?

<crontab>
    <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>
</crontab>
  • concrete? what do you mean by that? – Julien Lachal Jun 13 '16 at 15:44
  • I assume there is a concrete Magento cron task which does something, so it is required to refresh catalogrule rules after that – Raul Sanchez Jun 13 '16 at 15:45
1
+50

There is no cron job which "reset" catalog rules, but price generated by "catalogrule/observer::dailyCatalogUpdate" for the next day only.

So, if you have disabled this cron task - and it will miss a day - prices won't be renewed.

you can check DB table "catalogrule_product_price" - there is the "rule_date" field which showing which date you have rules generated for.

  • Ok. I suspected that, but I was not 100% sure – Raul Sanchez Jun 25 '16 at 17:50
0

From app/code/core/Mage/CatalogRule/etc/config.xml:

<crontab>
        <jobs>
            <catalogrule_apply_all>
                <schedule>
                    <cron_expr>0 1 * * *</cron_expr>
                </schedule>
                <run>
                    <model>catalogrule/observer::dailyCatalogUpdate</model>
                </run>
            </catalogrule_apply_all>
        </jobs>

\Mage_CatalogRule_Model_Observer::dailyCatalogUpdate :

/**
 * Daily update catalog price rule by cron
 * Update include interval 3 days - current day - 1 days before + 1 days after
 * This method is called from cron process, cron is working in UTC time and
 * we should generate data for interval -1 day ... +1 day
 *
 * @param   Varien_Event_Observer $observer
 *
 * @return  Mage_CatalogRule_Model_Observer
 */
public function dailyCatalogUpdate($observer)
{
    /** @var $resource Mage_CatalogRule_Model_Resource_Rule */
    $resource = Mage::getResourceSingleton('catalogrule/rule');
    $resource->applyAllRules();

    return $this;
}
  • I think you've misunderstood the question... what I ask is why does Magento need to run catalogrule_apply_all every day. In other words, which code or process (maybe a previous cron task) changes & disables current working catalogrules – Raul Sanchez Jun 22 '16 at 7:22
0

In order to fix this “fantastic feature” (read bug) you must implement Magento’s default cron job.

The only thing you need to do is add the following to your crontab file: */5 * * * * /absolute/path/to/bin/php -f /absolute/path/to/magento/cron.php So in my case, it was: */5 * * * * /usr/local/bin/php -f /var/www/websitefolder/htdocs/cron.php To get this into my crontab file via SSH:

1) Log in to server with username login 2) become root 'sudo -i' 3) edit crontab: 'crontab -e' 4) add the line 5) save and close the file

I refered link @ http://www.seankreps.com/magento-tips-faq/magento-catalog-price-rules-disappear-after-a-day/

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.