kjavitz Posted August 28, 2013 Share Posted August 28, 2013 Hi, having a hardtime getting a list of all available vars from the hook for order creation http://docs.whmcs.com/Hooks:Order_Process. Here is the code, I've tried different methods and always same result all I get is "1" which is not helpful for the email debug. Does anyone have any debug code that works and shows the variables? HELP function create_free_trial($vars) { $to = "kjavitz@gmail.com"; $subject = "Hello, i'm the hook!"; $varsemail = print_r($vars); $message = $varsemail; $from = "kjavitz@gmail.com"; $headers = "From:" . $from; mail($to,$subject,$message,$headers); } add_hook("AfterShoppingCartCheckout",1,"create_free_trial"); 0 Quote Link to comment Share on other sites More sharing options...
Kian Posted August 28, 2013 Share Posted August 28, 2013 Hi You can't print_r(); an array in a mailto(); You have to use $vars["variablename"]; function create_free_trial($vars) { $to = "kjavitz@gmail.com"; $subject = "Hello, i'm the hook!"; $varsemail = " 1->".$vars["variable1"]." 2->".$vars["variable2"]." 3->".$vars["variable3"]." "; $message = $varsemail; $from = "kjavitz@gmail.com"; $headers = "From:" . $from; mail($to,$subject,$message,$headers); } add_hook("AfterShoppingCartCheckout",1,"create_free_trial"); 0 Quote Link to comment Share on other sites More sharing options...
kjavitz Posted August 28, 2013 Author Share Posted August 28, 2013 thanks, actually I figured it out after posting this. The issue was it needed to have print_r($vars, TRUE) to make it return the values like: $varsemail = print_r($vars, TRUE); then all the variables are in the email. Weird thing is though that the product id returned is wrong it should be the product id of 15 but instead it gives the service id so I can't do an if statement to check what product was ordered, it does not give the product id for product, rather the order id, so I'll have ot custom code that I guess. Array ( [OrderID] => 876 [OrderNumber] => 5525116701 [serviceIDs] => Array ( [0] => 987 ) [DomainIDs] => Array ( ) [AddonIDs] => Array ( ) [RenewalIDs] => Array ( ) [PaymentMethod] => paypal [invoiceID] => 0 [TotalDue] => 0.00 [Products] => Array ( [0] => 987 ) [Domains] => Array ( ) [Addons] => Array ( ) [Renewals] => Array ( ) ) 0 Quote Link to comment Share on other sites More sharing options...
Kian Posted August 28, 2013 Share Posted August 28, 2013 What hook point are you using? 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.