News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

notify.php sending conformation mail twice...why?

Started by Risky, January 30, 2008, 23:47:19 PM

Previous topic - Next topic

Risky

For some strange reason notify.php sending conformation mail twice...

I have modified notify.php according to my own needs and after the conformation that info comes from bank I want to update order status as following:


if ($BANK_response == '1101') ///UPDATE THE ORDER STATUS to 'Confirmed'
{
$d['order_id'] = $order_id;
$d['notify_customer'] = "Y";
$d['order_status'] = BANK_VERIFIED_STATUS;
require_once ( CLASSPATH . 'ps_order.php' );
$ps_order= new ps_order;
$ps_order->order_status_update($d);
$mail->From = $mosConfig_mailfrom;
$mail->FromName = $mosConfig_fromname;
$mail->AddAddress($mosConfig_mailfrom);
$mail->Subject = "Successful payment";
$mail->Body = "Order ID: $order_id\n";
$mail->Body .= "Order Status Code: ".$d['order_status'];
$mail->Send();
}
else // UPDATE THE ORDER STATUS to 'Canceled'
{
$d['order_id'] = $order_id;
$d['notify_customer'] = "Y";
$d['order_status'] = BANK_PENDING_STATUS;
require_once ( CLASSPATH . 'ps_order.php' );
$ps_order= new ps_order;
$ps_order->order_status_update($d);
$mail->From = $mosConfig_mailfrom;
$mail->FromName = $mosConfig_fromname;
$mail->AddAddress($mosConfig_mailfrom);
$mail->Subject = "Order was canceled ";
$mail->Body = "Order ID: $order_id\n";
$mail->Body .= "Order Status Code: ".$d['order_status'];
$mail->Send();
}


If user cancels transaction... everything works... customer and admin get email that order was canceled and order status is changed to "Canceled"

If transaction is successful both customer and admin will get conformation email twice... two identical emails... and order status is changed to "Successful". Have anyone had similar experience? Why it sending the same email twice if transaction is successful?

Joomal 1.0.13 and VirtueMart 1.0.13a