Author Topic: Needing help with examples, for me to continue through  (Read 1400 times)


  • Beginner
  • *
  • Posts: 6
Needing help with examples, for me to continue through
« on: February 25, 2012, 02:28:03 am »
I want to sell services through Virtuemart, which are tied to another system via HTTPS REST requests.  So when a customer purchases a service, after payment the request is processed through cURL and a record of it saved to the Joomla database.  And this is neither physical goods nor downloadable files, so I will need a way to prevent shipping or download options...I assume that's through the templates, but I'm not positive.  Please let me know how that works, also.

Essentially the order process would work like this:
Code: [Select]
$neworder = https://testapisite/newaccount/add.xml
$fields = array(
'name' => $name,
'customerid' => $customerid,
'months'=> $planid
function save_order($neworder,$fields) {
$fields_string = '';
//url-ify the data for the POST
foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; }
//open connection

$ch = curl_init();
//set the url, number of POST vars, POST data
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
//execute POST
$result = curl_exec($ch);
if(curl_getinfo($ch, CURLINFO_HTTP_CODE) === 200) {
$db = JFactory::getDBO();
$data =new stdClass();
if (!$db->insertObject( '#__customers', $data)) {
echo $db->stderr();
return false;
} else {
return true;
} else {
return false;