0
votes

I've an e-commerce website powered by Magento but now I need to make the connection bewteen Magento and the company's management software.

The process should be this:

  1. The user put some stuff in his cart
  2. The user go through the checkout process
  3. After the user have paid the total with Paypal, Magento should send an HTTP request (perhaps POST, with order's data) to an external server that handles the request and do stuff with the data received.

My problem is that I've no idea how to send a request from Magento with the order data after the checkout process. I think this is a common scenario for companies that uses e-commerce. Do you have some ideas for this? Thanks.

2

2 Answers

2
votes

You can use a observer to get the after checkout event, and on your observer you can send some kind of curl post to your external server. (Like @Prasath Albert said)

Take a look there to make a observer: http://www.magentocommerce.com/wiki/5_-_modules_and_development/0_-_module_development_in_magento/customizing_magento_using_event-observer_method

You are looking for checkout_cart_save_after. Good lucky, let me know if you need something else.

Edit:

Use this tutorial to do your Observer http://www.magentocommerce.com/wiki/5_-_modules_and_development/0_-_module_development_in_magento/customizing_magento_using_event-observer_method make 100% like this. Create new module to do it.

Then your observer method can be something like that:

function observermethod($observer){
    $observer->getEvent->getOrder()->getData();
}
1
votes

you can use the CURL to achieve this. for this

1) Add a page in the external server for handling the inputs from the magento.

2) Edit the Magento Cart functionality, to send a request to the External server.

Ex: you can use the CURL to make this request.

   $data = "item=".$item;//input data
   $url="http://External server/handler.php";
   $handle = curl_init($url);
   curl_setopt($handle, CURLOPT_POST, true);
   curl_setopt($handle, CURLOPT_POSTFIELDS, $data);
   curl_exec($handle);