Jump to content

Action Hook not working


Recommended Posts

Hi all,

 

I have never worked with action hooks before, but I need to run some code now when an order is complete to do some split page testing...

 

I got the example action hook in includes/hooks to send me an email when a new client registers, then I modified that code for the order complete hook, but that does not work (does not send me a mail).

 

The code is:

 

<?php
/* ******************************************************
              ** Example Hook Function **

Please refer to http://wiki.whmcs.com/Hooks for more info
*/
function hook_OrderComplete_HomePage_SplitTest($vars) {

   $orderid = $vars['orderid'];
   $ordernumber = $vars['ordernumber'];
   $invoiceid = $vars['invoiceid'];



   # Run code to create remote forum account here...
   $Message = "OrderID: ".$orderid."\r\nOrderNumber: ".$ordernumber."\r\nInvoiceID: ".$invoiceid."\r\nPageSplit: \r\n";

   mail("john@softsmart.co.za", "NEW ORDER PAGE SPLIT TEST", $Message);
}

add_hook("ShoppingCartCheckoutCompletePage",1,"hook_OrderComplete_HomePage_SplitTest");


?>

 

This file is still in the same place (includes/hooks/example.php).

 

Am I missing something? Is there something I need to put into one of the template files to call this hook?

 

Thanks...

 

John

Link to comment
Share on other sites

  • 9 months later...
Hi all,

 

I have never worked with action hooks before, but I need to run some code now when an order is complete to do some split page testing...

 

I got the example action hook in includes/hooks to send me an email when a new client registers, then I modified that code for the order complete hook, but that does not work (does not send me a mail).

 

The code is:

 

<?php
/* ******************************************************
              ** Example Hook Function **

Please refer to http://wiki.whmcs.com/Hooks for more info
*/
function hook_OrderComplete_HomePage_SplitTest($vars) {

   $orderid = $vars['orderid'];
   $ordernumber = $vars['ordernumber'];
   $invoiceid = $vars['invoiceid'];



   # Run code to create remote forum account here...
   $Message = "OrderID: ".$orderid."\r\nOrderNumber: ".$ordernumber."\r\nInvoiceID: ".$invoiceid."\r\nPageSplit: \r\n";

   mail("john@softsmart.co.za", "NEW ORDER PAGE SPLIT TEST", $Message);
}

add_hook("ShoppingCartCheckoutCompletePage",1,"hook_OrderComplete_HomePage_SplitTest");


?>

 

This file is still in the same place (includes/hooks/example.php).

 

Am I missing something? Is there something I need to put into one of the template files to call this hook?

 

Thanks...

 

John

 

Hi John

 

Have, you managed to get this work? I'm sitting with a similar situation where the hook just doesn't seem to be executing.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated