Code: Select all
if ($result == "00") {
// check that the invoice has not been previously processed
$sql = "SELECT od_status
FROM tbl_order
WHERE od_id = {$_POST['ORDER_ID']}";
$result = dbQuery($sql);
// if no invoice with such number is found, exit
if (dbNumRows($result) != "00") {
exit;
} else {
$row = dbFetchAssoc($result);
$_SESSION['mydatabase_od_id'] = $row['od_id'];
// process this order only if the status is still 'New'
if ($row['od_status'] !== 'New') {
exit;
} else {
// ok, so this order looks perfectly okay
// now we can update the order status to 'Paid'
// update the memo too
$sql = "UPDATE tbl_order
SET od_status = 'Paid', od_memo = '$memo', od_last_update = NOW()
WHERE od_id = '{$row['od_id']}'";
$result = dbQuery($sql);
}
}
/* --------------------------------------------------------------
Send notification email to yourself.
*/
if ($shopConfig['sendOrderEmail'] == 'y') {
$subject = "[New Order] " . $_SESSION['orderId'];
$email = $shopConfig['email'];
$message = "\n A customer has sent you a new order. Follow the link for the order details \n http://"
. $_SERVER['HTTP_HOST'] . '/my/orders/index.php?view=detail&oid='
. $_SESSION['orderId']
. "\n If you cannot open the link or are having problems logging in to your account please contact the Site Administrator. \n" ;
mail($email, $subject, $message, "From: $email\r\nReturn-path: $email");
}
?>
Thank you
<br/><br/>
To continue browsing please <a href="http://yourdomain.com"><b><u>click here</u></b></a>
<br/><br/>
<?
} else {
?>