0

I am writing a Magento extension that will export orders to a 3rd party upon cart submission. I did an equivalent plugin for WordPress a few months ago. The way I did it was that everytime a user would submit an order, I would create a single WordPress cron job (wp_schedule_single_event) so that there was no delay for the user (and that the export job would run in the background due to the way WP-Cron works).

Now, this worked great, and I would like to do something similar with Magento. Magento does have a CRON, but it doesn't seem to have a way of scheduling single events. I was thinking of doing the following:

  1. When an order is submitted, write this order number into a table.
  2. Create a request to a php file that I have created which handles querying the above mentioned table and exporting the orders.

My questions are:

  1. How do I send a request to a php file through PHP that basically kicks off the page load, but doesn't wait for a response?
  2. Are there any flaws in my process that I am missing?
Jerry Coffin
  • 476,176
  • 80
  • 629
  • 1,111
Lock
  • 5,422
  • 14
  • 66
  • 113

1 Answers1

1

The closest you can get to that behavior in PHP (that I've seen) is using sockets, (per this previous Stack Overflow question) although it'll be impossible to tell if your request finished or not.

Community
  • 1
  • 1
Alana Storm
  • 164,128
  • 91
  • 395
  • 599
  • Thanks I will take a look. I'm not at all worried if the request finishes all not as the script will log failure/success into another table. Alan Storm... if its you, I was just reading your articles.. they are fantastic! – Lock May 01 '13 at 01:19