问题
i have been working on Whmcs for a while now and i am trying to run a custom hook when Admin Accepts and order but there are two things that i am not sure of doing
How Can I call Api Of Whmcs From A Hook file?
What i want to do is when a Admin accepts an order, A hook runs and in that hook I am trying to get these things orderid *(which order is accepted by the admin and against which user)* and the client information can you please guide me through the generic steps involved
回答1:
1-You call internal API of whmcs within a hook file under /includes/hooks/
folder.
And how to that is the following :
http://docs.whmcs.com/API:Internal_API
2- You need to call "AfterShoppingCartCheckout" hook to do that.
Simply, create a php file under /includes/hooks/
folder, and within this file you can use the sample code below :
<?php
function myActionHookFunctionvars($vars) {
$orderId= $vars['OrderID'];
//Run code to dı what you want here,
// you can even call internal api here.
}
add_hook("AfterShoppingCartCheckout",1,"myActionHookFunctionvars");
?>
来源:https://stackoverflow.com/questions/20948319/get-order-client-information-in-a-hook