0

I want to set up an affiliate program for an online store that uses Magento for e-commerce. How could I save the order id of a sale to be used to update my affiliate table?

Please do not recommend 'Affiliates for all'. It is about as inflexible as Magento, and the reason that I am going with a custom made solution. Any help is appreciated.

Jonathan Day
  • 18,519
  • 10
  • 84
  • 137
Toya
  • 1
  • 1

1 Answers1

0

When developing external applications for Magento I usually reach for the Magento API. This would minimize the amount of work you have to do on the Magento side of things (which from my experience can be frustrating at times). You can focus more on your application and less on the data you need from Magento.

To answer your question more directly, you need to use the order API calls.

Example (To get list of orders):

$proxy = new SoapClient('http://www.YOURDOMAIN.com/magento_root/api/soap/?wsdl');
$sessionId = $proxy->login('Username', 'password');

$filters = array();

$orders = $proxy->call($sessionId, 'sales_order.list', array($filters));
var_dump($orders);
KTastrophy
  • 1,739
  • 15
  • 23
  • Thanks alot. Could I call this from a script aside from Magento? – Toya Jan 24 '11 at 09:42
  • Yep, see the example I added to my answer. Just point the script to your Magento installation and use the API credentials you set up in the backend. – KTastrophy Jan 24 '11 at 10:14