Pergunta

Under my Catalog Price Rules we have a daily special being applied to 2 categories. The issue we're having is at the top of the page we see:

There are rules that have been changed but were not applied. Please, click Apply Rules in order to see immediate effect in the catalog.

Clicking apply executes for a very long time. I extended the php execution and apache timeouts so there is no 500 returned, however, the apply button just doesn't appear to function at all. I really wish I had more information on this issue, but nothing shows up in the system.log or exception.log.

If anyone has any insight into what might cause this function to hang indefinitely, it would be greatly appreciated.

Foi útil?

Solução

We have the same problem, we use a PHP script to apply the Catalog Price Rules with the following PHP script (placed in the shell directory):

<?php require_once '../Mage.php'; ini_set('display_errors', 1);
#Varien_Profiler::enable();

Mage::setIsDeveloperMode(true);

umask(0); Mage::app('default');

Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);

        try {
            Mage::getModel('catalogrule/rule')->applyAll();
            Mage::app()->removeCache('catalog_rules_dirty');
            echo Mage::helper('catalogrule')->__('The rules have been applied.');
        } catch (Exception $e) {
            echo Mage::helper('catalogrule')->__('Unable to apply rules.');
            print_r($e);
        }

Just run it with php nameofscript.php and the rules will be applied.

Outras dicas

Just adding this as it is something I just ran into.

Store has tons of SKUs and Catalog Price Rules. The rules weren't being applied, and after debugging cron and other things that have been a problem in the past, I took a look at the catalogrule_product_price table to see what was there. I saw a single entry:

enter image description here

Notice the value for rule_product_price_id -- Indeed, the max value for an INT(10) field. Reset your auto-increment and you should be good.

I found a solution to this by making sure the database user has privileges to create tables into magento database.

Applying price rules seems to create some temporary tables which my database user wasn't allowed to do.

Settings are located in app/etc/local.xml

Hope this saves someones day :)

-MPu

Licenciado em: CC-BY-SA com atribuição
Não afiliado a magento.stackexchange
scroll top