Magento Forum

   
…make a catalog price rule “stick” for more than a day? 
 
macsmart
Jr. Member
 
Total Posts:  29
Joined:  2007-08-31
Greensboro, NC
 

I have created 2 Catalog Pricing Rules for 2 separate products:

http://shop.williammangumfineart.com/catalog/category/view/s/special-offers/id/28/

The rules:

If ALL of these conditions are TRUE :
* SKU is COMP-MINI-2007
Perform following actions:
* Update product’s Rule price To Fixed Value : 0.00

— and —

If ALL of these conditions are TRUE :
* SKU is COMP-MINI-FRAMED-2007
Perform following actions:
* Update product’s Rule price To Fixed Value : 45.00

Both rules are enabled, the english store (the only one I have) selected and set with a “to date” of 12/15/07, Priority “0”

After creating and applying these rules, the “Special Prices” display correctly immediately and for some time after. The problem is that somewhere between 12 and 36 hours later, both rules stop working, and the prices go back to normal. Applying them again fixes the problem, but they have yet to stick for good.

I did not have caching enabled the first few times this happened, and I’ve now tried it with all caches enabled. Didn’t help… :(


 
Magento Community Magento Community
Magento Community
Magento Community
 
Moshe
Magento Team
 
Avatar
Total Posts:  1770
Joined:  2007-08-07
Los Angeles
 

The prices are calculated and cached per day.

There’s a routine that should run every day and update information for next few days for whole catalog.
The cronjob part is not finalized yet, so this does not happen.

In app/code/core/Mage/CatalogRule/Model/Mysql4/Rule.php on line 56 there’s:

$toTime strtotime($rule->getToDate())+86400;

86400 (24*60*60) is amount of seconds from today until the prices should be calculated.

Change this to be (30*24*60*60) = 2592000 to create prices for next month, but when you click “Apply Rules”, you will have to wait some time.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Moshe
Magento Team
 
Avatar
Total Posts:  1770
Joined:  2007-08-07
Los Angeles
 

I’m sorry, the right way is here:
in app/code/core/Mage/Adminhtml/controllers/Promo/CatalogController.php on line 186 there’s this line:

$resource->applyAllRulesForDateRange($resource->formatDate(mktime(0,0,0)));
It needs 2nd parameter to specify more than one day range:
$resource->applyAllRulesForDateRange($resource->formatDate(mktime(0,0,0)), $resource->formatDate(mktime(0,0,0)+2592000));

 
Magento Community Magento Community
Magento Community
Magento Community
 
Emily
Jr. Member
 
Avatar
Total Posts:  22
Joined:  2008-03-31
Atlanta
 

Is there any progress on a cron job for the catalog price rules?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Moshe
Magento Team
 
Avatar
Total Posts:  1770
Joined:  2007-08-07
Los Angeles
 

@Emily: did you try adding line similar to this one to your crontab?

*/* * * * /absolute/path/to/php5/php -/absolute/path/to/magento/cron.php

 
Magento Community Magento Community
Magento Community
Magento Community
 
Emily
Jr. Member
 
Avatar
Total Posts:  22
Joined:  2008-03-31
Atlanta
 

I didn’t have that in my cron tab.  I’ll check tomorrow and see if that has solved the problem.  Thanks.

 
Magento Community Magento Community
Magento Community
Magento Community
 
tomasz77
Jr. Member
 
Total Posts:  1
Joined:  2008-06-17
 
Moshe - 25 April 2008 12:17 PM

@Emily: did you try adding line similar to this one to your crontab?

*/* * * * /absolute/path/to/php5/php -/absolute/path/to/magento/cron.php

I added this to my crontab yesterday, but again this morning catalog rules wasn’t applied…

 
Magento Community Magento Community
Magento Community
Magento Community
 
mmbl13
Jr. Member
 
Total Posts:  5
Joined:  2008-04-13
 

i have the same problem
cronjob is:
*/5 * * * * /usr/bin/php -f /var/www/shop/cron.php

rules are gone each morning :/

 
Magento Community Magento Community
Magento Community
Magento Community
 
Unirgy
Guru
 
Avatar
Total Posts:  478
Joined:  2007-09-07
 

interesting, my crontab is working..
add to the beginning of your crontab file:

MAILTO=youremail@yourserver.com
will you receive any notifications or errors?

 
Magento Community Magento Community
Magento Community
Magento Community
 
mmbl13
Jr. Member
 
Total Posts:  5
Joined:  2008-04-13
 

Hi Saharian,

your’re right! cron.php couldn’t be executed because of memory limit in php5.ini - i had to change cli/php.ini for that smile
thanks! seems to work now!

 
Magento Community Magento Community
Magento Community
Magento Community
 
revenson
Jr. Member
 
Total Posts:  3
Joined:  2008-11-26
 

Is this still applicable? I still have this problem but the code has changed in version 1.1.8.

 
Magento Community Magento Community
Magento Community
Magento Community
 
jacrod
Jr. Member
 
Total Posts:  13
Joined:  2009-01-14
 

Hi:

I made in my crontab:

*/5 * * * * /absolute/path/to/php5/php -f /absolute/path/to/magento/cron.php

and:

MAILTO=youremail@yourserver.com ,

but it didnt work and I recieved:


PHP Warning:  realpath(): SAFE MODE Restriction in effect.  The script whose uid is 48 is not allowed to access /var/www/vhosts/encinaresdelsur.com/httpdocs/tiendajamon/app owned by uid 0 in /var/www/vhosts/encinaresdelsur.com/httpdocs/tiendajamon/app/Mage.php on line 162

Warning: realpath(): SAFE MODE Restriction in effect.  The script whose uid is 48 is not allowed to access /var/www/vhosts/encinaresdelsur.com/httpdocs/tiendajamon/app owned by uid 0 in /var/www/vhosts/encinaresdelsur.com/httpdocs/tiendajamon/app/Mage.php on line 162
PHP Fatal error:  Uncaught exception ‘Mage_Core_Exception’ with message ‘ is not a directory or not readable by this user’ in /var/www/vhosts/encinaresdelsur.com/httpdocs/tiendajamon/app/Mage.php:407
Stack trace:
#0 /var/www/vhosts/encinaresdelsur.com/httpdocs/tiendajamon/app/Mage.php(167): Mage::throwException(’ is not a direc...’)
#1 /var/www/vhosts/encinaresdelsur.com/httpdocs/tiendajamon/app/Mage.php(510): Mage::setRoot()
#2 /var/www/vhosts/encinaresdelsur.com/httpdocs/tiendajamon/cron.php(29): Mage::isInstalled()
#3 {main}
thrown in /var/www/vhosts/encinaresdelsur.com/httpdocs/tiendajamon/app/Mage.php on line 407

Fatal error: Uncaught exception ‘Mage_Core_Exception’ with message ‘ is not a directory or not readable by this user’ in /var/www/vhosts/encinaresdelsur.com/httpdocs/tiendajamon/app/Mage.php:407
Stack trace:
#0 /var/www/vhosts/encinaresdelsur.com/httpdocs/tiendajamon/app/Mage.php(167): Mage::throwException(’ is not a direc...’)
#1 /var/www/vhosts/encinaresdelsur.com/httpdocs/tiendajamon/app/Mage.php(510): Mage::setRoot()
#2 /var/www/vhosts/encinaresdelsur.com/httpdocs/tiendajamon/cron.php(29): Mage::isInstalled()
#3 {main}
thrown in /var/www/vhosts/encinaresdelsur.com/httpdocs/tiendajamon/app/Mage.php on line 407

I have in my server safe mode OFF, so I dont know what is happening?

Anyone can help me?

Thanks

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
    Back to top