Pass order data to Interspire Email Marketer

Pass order data to Interspire Email Marketer

Postby smalkin@.....com » Fri May 25, 2012 10:37 pm

Hey guys,

first of all, let me thank you for this awesome component - a must have for every VM user! ;)

We've been building a shop which uses OPC for a few moths now.
As we're getting more and more order, we're looking for a way to capture every info on each order and pass it to Interspire Email Marketer. The reason why every info needs to be captured is that we're planning on offering various deals to customers who ie.: made the payment through PayPal, or ordered above a certain amount - Interspire will help us automatize this.

I've been thinking over and over how to achieve this and my best guess that the API call should be placed within the email_receipt function, so when a confirmed order comes in, the data that will be sent out as the receipt could be passed along with curl to Interspire.

Let me paste the sample code for this API call i need to make:
Code: Select all
<?php
$xml = '<xmlrequest>
<username>admin</username>
<usertoken>d467e49b221137215ebdab1ea4e046746de7d0ea</usertoken>
<requesttype>subscribers</requesttype>
<requestmethod>AddSubscriberToList</requestmethod>
<details>
<emailaddress>email@domain.com</emailaddress>
<mailinglist>1</mailinglist>
<format>html</format>
<confirmed>yes</confirmed>
<customfields>
<item>
<fieldid>1</fieldid>
<value>John Smith</value>
</item>
</customfields>
</details>
</xmlrequest>
';
$ch = curl_init('http://www.yourdomain.com/IEM/xml.php');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $xml);
$result = @curl_exec($ch);
if($result === false) {
echo "Error performing request";
}
else {
$xml_doc = simplexml_load_string($result);
echo 'Status is ', $xml_doc->status, '<br/>';
if ($xml_doc->status == 'SUCCESS') {
echo 'Data is ', $xml_doc->data, '<br/>';
} else {
echo 'Error is ', $xml_doc->errormessage, '<br/>';
}
}
?>


Can you please help me out with this or guide me through the light? :)

Thank you very much in advance,

Matt (the tech guy)
smalkin@.....com
 
Posts: 1
Joined: Thu May 03, 2012 2:02 pm

Re: Pass order data to Interspire Email Marketer

Postby admin » Tue May 29, 2012 7:08 pm

Hello Matt,
the OPC1 already contains an API to generate XMLs on each confirmed order. It is done with the ps_order (extended class) which can be installed within the emails tab. The ps_order waits for the order status updates (from all payment plugins) or (for pending status for all orders). The XML feature is to generate the PDFs when configured: it sends XML (of your order data) + XLS (or ods...) to our virtual servers which convert it to PDF. If you are only interested in the XML, please have a look on this class and function:

/administrator/components/com_onepage/assets/export_helper.php

function getXml(templateId, orderId, prevDataIfAny)

it returns XML of any information which could found about your order as configured at the export tab per template.

function sendData sends the data to our server - so you may want to capture and save the generated XML here.

If you needed enterprise help on this let me know by mail at info@rupostel.com .

Best Regards,
Stan
admin
Site Admin
 
Posts: 2708
Joined: Wed Jan 06, 2010 11:43 pm


Return to One Page Checkout for Virtuemart 1.1.x

cron