You might not know what a cron job is, but it would make your life easier if Prestashop had one. So many wonderful and amazing features could be unlocked if Prestashop took advantage of this technology that has been around for decades. If you are unfamiliar with what a cron is, it is a schedule task on its simplest sense.
Things you could do if Prestashop had built in cron functionality
- Schedule Products. You could schedule products to be active and in active based on the times with a cron job. An example would be if you were selling a product that could not be sold before midnight on a certain date.
- Schedule Slides. You could easily schedule slides to be active / deactivated at certain times based on dates. Like in the example above, you were selling a product that has to be released at midnight, you could have a slide appear at midnight to advertise the product.
- Currency Rates. Currency rates could automatically be updated without having to put a manual job together.
- Clearing the Cache. The cron configuration could automatically be set to clear the Prestashop cache to keep file on disk size down.
- Schedule Shop Maintenance. With a built in cron, you could schedule things such as deleting old abandoned carts, deleting products that are older than a certain date, or even changing shipping rates on a specific date.
- Schedule Better Sales. It would be easy to schedule sales that involved multiple items like say for one day only you want to offer an xbox with a game on sale, or for even one hour, you could.
- Search indexes and Layered Navigation indexes could be automatically rebuilt. This would be especially useful if you were running a product feed that updated automatically.
How it could extend modules
- Shipping rate caches could be deleted.
- Abandoned cart emails could be sent automatically.
- Modules could be enabled or disabled depending on the date.
- Modules that generate feeds such as Google Merchant of Amazon modules could automatically update and sync with the services.
- Things I haven’t even thought of yet. (No seriously, special modules could be designed around it)
In my mind the best way to handle the cron would be to have a hook dedicated to it that modules could hook into. That way modules that were compatible would be able to use the cron feature and modules that were not compatible would not be able to use it. Also I think a setting in the back office to adjust the cron settings would be needed. Something where you can set how often you want the cron to work. Also, at the same time I purpose that their be two types of cron’s, the poor mans cron (or pseudo cron) and a fully functional cron that has to be set on the server. This would give flexibility to people that do not know how to set a cron job on their server.
It looks like we were heard by PrestaShop. They responded to my feature request and said they just started working on one. Also I noticed that there is now a cron module on the github for PrestaShop as well. This is a great feature that I think will help keep PrestaShop as the best e-commerce platform in the world.
About the Author: Lesley Paone
Lesley has worked in e-commerce for over a decade, and is the founder of dh42. Starting out with PrestaShop and brancing out into other platforms like Shopify. He loves all things e-commerce and loves a challenge, in his spare time he helps moderate several forums on SEO, e-commerce, as well as the PrestaShop forum. If you have any questions for him about any of his articles just use our contact form to contact him.