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

Stig
  • 63
  • 1
  • 1
  • 5
  • 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. – Ben Lessani Oct 10 '14 at 00: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 Oct 10 '14 at 10:42

1 Answers1

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?

MagePal Extensions
  • 13,911
  • 2
  • 33
  • 52