I'm trying create simple new cron job for my module in Prestashop. Everywhere I see to do it I must define my cron in admin panel. But it seems stupid, because I won't write to each person which download my module to activate this cron manually. I wrote cron jobs for wordpress and magento without problem, but in Prestashop I can't find any tutorial when would be described this process. It is possible to write and activate cron automatically?
Thanks
The following applies to Prestashop's "native" cronjob handler (version 1.3.2)
You can make your module auto-install a cronjob by ensuring the following:
actionCronJobgetCronFrequency()actionCronJob()getCronFrequency should return an array that looks like this:
array('hour'=>1, 'day'=>-1, 'month'=>-1, 'day_of_week'=>1);
The -1 values are the equivalent of the * in Unix-style cronjobs.
Be aware though, that "Basic" mode cron jobs get triggered by a webservice hosted by Prestashop themselves. This means your website has to be publicly accessible so you can't easily test this on your typical localhost development environment.
Advanced cronjobs are not registered at Prestashop's webservice, so you can trigger them yourself through your own crontab manager.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With