4

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.

  • How many products are in the categories? How much products(skus) do you have? Please provide the rules. – Fabian Blechschmidt May 25 '13 at 10:23
  • There are a total of 6000 products in the database, the client uses a lot of duplication, which I believe may cause conflicts when writing to the database for any unique key columns. The rules are as follows: If ALL of these conditions are TRUE : Daily Special Date is 2013-06-04 This is a daily special that repeats each day in a cron job, which will adjust the price to 50.000% for items in two specific categories. I added the categories to the rule, and it seems to have fixed it after a couple days without applying, however these categories seem to be gone from the rule now. – DWils Jun 5 '13 at 5:57
11

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.

  • Thanks so much for your reply! It seems that by changing the rule and letting the system sit overnight, the cron jobs took care of it, the apply button still does not work, but if I understand correctly, that is just to get immediate results. – DWils Jun 5 '13 at 6:03
  • if i want rewrite on magento cron sructure and try to it as module stucture then is it need to include Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);? – Amit Bera Oct 8 '14 at 3:58
  • 1
    Worth noting that more recent versions of Magento need the require once mage path to be as follows (certainly in Magento 1.9.x): <?php require_once '../app/Mage.php'; ini_set('display_errors', 1); – robgt Apr 19 '16 at 10:02
2

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.

0

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

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.