سؤال

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>
هل كانت مفيدة؟

المحلول

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.

نصائح أخرى

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;
}

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/

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى magento.stackexchange
scroll top