Hello,
If new invoice created and paymentmethod=paypal {add the $3.00 + invoice total }
But my function does not working please help me :(
If new invoice created and paymentmethod=paypal {add the $3.00 + invoice total }
But my function does not working please help me :(
PHP Code:
<?php
if (!defined("WHMCS"))
die("This file cannot be accessed directly");
function addcommission($vars) {
$paymentmethod = $vars['paymentmethod'];
if($paymentmethod=="paypal"){
$userid = $vars['userid'];
$where1 = array("userid"=>$userid);
$result1 = select_query('tblinvoices','subtotal',$where1);
$data = mysql_fetch_array($result);
$subtotal = $data['subtotal'];
$invoiceid = $vars['invoiceid'];
$addvalue="3.00";
$add_commission = $subtotal+$addvalue;
$table = "tblinvoices";
$update = array("subtotal"=>$add_commission);
$where = array("invoiceid"=>$invoiceid,"status"=>"Unpaid");
update_query($table,$update,$where);
}
return;
}
// Define Client Logout Hook Call
add_hook("InvoiceCreated",0,"addcommission");
?>