It turned out to be a PHP error after all, including a problem from calling that submit_form function from within the class. There was also an error in the urlencode code for countries. Here's the finished product, which will post to our custom script every time a new item is ordered and paid for. Thanks very much for your help.
PHP Code:
<?php
class orderNotifier extends base {
function orderNotifier() {
# $this->attach($this, array('NOTIFY_CHECKOUT_PROCESS_BEGIN', 'NOTIFY_HEADER_START_CHECKOUT_PAYMENT', 'NOTIFIER_CART_SHOW_TOTAL_START'));
$this->attach($this, array('NOTIFY_ORDER_AFTER_SEND_ORDER_EMAIL'));
}
function update(&$Class, $notifier, $paramsArray) {
$num = $paramsArray[0];
$cust = $Class->customer;
$country = urlencode($cust['country']['title']);
foreach ($cust as $k => $v)
if (!is_array($v))
$cust[$k] = urlencode($v);
$inf = $Class->info;
if ($inf['order_status'] == 2) {
foreach($Class->products as $prod) {
$url = 'http://www.yoururl.com/yourpage.php?num=' . $num . '&firstname=' . $cust['firstname'] . '&lastname=' . $cust['lastname'] . '&email=' . $cust['email_address'] . '&company=' . $cust['company'] . '&address=' . $cust['street_address'] . '&city=' . $cust['city'] . '&state=' . $cust['state'] . '&postcode=' . $cust['postcode'] . '&country=' . $country . '&telephone=' . $cust['telephone'] . '&qty=' . $prod['qty'] . '&prod_name=' . urlencode($prod['name']) . '&id=' . urlencode($prod['id']);
$ch = curl_init();
curl_setopt($ch, CURLOPT_INTERFACE, 'yourip');
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_TIMEOUT, 20);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$data = curl_exec($ch);
}
}
}
}
?>
Bookmarks