Magento – Schedule cron for multiple stores

ce-1.9.0.1cron

I'm trying to execute a cron (that disables certain products) on a per store basis, with timing set in the backend.

I have been looking at: http://inchoo.net/ecommerce/magento-configurable-cron/
and can get that working. But only for the default store. If I set one time in default settings and another time in store level settings, only the default runs.

My questions is, how do I apply this to multiple stores? Is there a way to give the cronjob the scope (storeID) it should run in the settings and how do I ensure the crontab picks all the times from different stores?

Best Answer

One solution I can think of is that you could set up separate different cron jobs for different stores, such that it one cron jobs deals with only one store id. You could just hard code the corresponding store's id in the cron job that is meant for the store.

From:

Mage_Cron_Model_Observer::_generateJobs($jobs, $exists)

 $cronExpr = Mage::getStoreConfig((string)$jobConfig->schedule->config_path);

From the above code it seems like it will always pick the config schedule from the default store than for each store, although I could be wrong.