1

Hope some of your clever magento guys can help me :)

I have a custom plugin with a mobil case designer - when an order is placed and the payment are registered, cron should automaticly send this designed case to a printmanager.

In my cpanel i have a cron job that activates cron.php - but nothing happens to the order, it will not send it throug. But it will send it through if I manually activate cron.php in my browser?? Why and what can I do? I have been in touch with my hosting, and the log says it activates the cron.php like it should

2
  • 1
    Firstly, you should be executing cron.sh, not cron.php - so that you don't double -execute your cron. Secondly, for visibility of crons, consider using Aoe_Scheduler, its very handy. Commented Oct 10, 2014 at 0:13
  • Hey - thx for your comment :) So my cron job should activate .sh instead of php? I too a look at the Aoe_scheduler - will try to test it on demo site since it is only supporting up to 1.7
    – Stig
    Commented Oct 10, 2014 at 10:42

1 Answer 1

1

A cron job is a scheduled task that is executed by the system at a specified time/date interval.

Since orders are placed at a more random interval and the only way to catch all order would be to run it every second or do a look up for all orders place since last cron ran, therefore using a cron is not the best solution and would require a lot of work to catch and process all orders.

A better way to accomplish what you are trying to do in magento is to use event/observer

You could create an observer for sales_order_place_after see Customize Magento using Event/Observer (if you are not processing credit card in realtime then you could use another event see Where can I find a complete list of Magento events?

1
  • Hello - thx for your answer. I will take a look in to your suggestion.
    – Stig
    Commented Oct 10, 2014 at 10:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.