Call-back icon  Sales: Call 877.832.5289 (N America)|310.295.4144 (International)

Magento

eCommerce Software for Online Growth

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:  1771
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.

 Signature 

- I would love to change the world, but they won’t give me the source code -

 
Magento Community Magento Community
Magento Community
Magento Community
 
Moshe
Magento Team
 
Avatar
Total Posts:  1771
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));

 Signature 

- I would love to change the world, but they won’t give me the source code -

 
Magento Community Magento Community
Magento Community
Magento Community
 
Emily
Jr. Member
 
Total Posts:  18
Joined:  2008-03-31
 

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

 Signature 

NeboWeb.com

 
Magento Community Magento Community
Magento Community
Magento Community
 
Moshe
Magento Team
 
Avatar
Total Posts:  1771
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

 Signature 

- I would love to change the world, but they won’t give me the source code -

 
Magento Community Magento Community
Magento Community
Magento Community
 
Emily
Jr. Member
 
Total Posts:  18
Joined:  2008-03-31
 

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

 Signature 

NeboWeb.com

 
Magento Community Magento Community
Magento Community
Magento Community
 
tomasz77
Jr. Member
 
Total Posts:  1
Joined:  2008-06-17
 
Moshe - 25 April 2008 01: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
Sr. Member
 
Avatar
Total Posts:  114
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
Magento Community
Magento Community
    Back to top
 
Sales: Call 877.832.5289 (North America) 310.295.4144 (International)
© Copyright 2008 Varien. Magento, eCommerce software, is a trademark of Irubin Consulting Inc. DBA Varien
Privacy Policy|Terms of Service
Magento Community Count
50108 users|427 users currently online|102246 forum posts