archi Posted February 27, 2012 Share Posted February 27, 2012 Hi guys, because WHMCS is something new to me and I'm not very experienced PHP programmer, I've got a small question. I want to add a function that will collect all client's data and order data at the end of ordering process (I want use ShoppingCartValidateCheckout or AfterShoppingCartCheckoutc hook and internal API variables). Then it should be sent somewhere, but that's another story... However I'm confused with some documentation info about creating hooks... There is no "order" module in /modules/addons/, where hooks can be added. In process' order I'm using verticalsteps template (...\whmcs\templates\orderforms\verticalsteps) But where should I insert the code of the hook? Should I add hooks.php in ...\whmcs\templates\orderforms\verticalsteps ? Or maybe should I write the code of the hook in the template code ...\whmcs\templates\orderforms\verticalsteps\viewcart.tpl in {literal} tags? My WHMCS version is 5.0.3. I will be grateful for help. 0 Quote Link to comment Share on other sites More sharing options...
laszlof Posted February 27, 2012 Share Posted February 27, 2012 You place your hooks into the includes/hooks directory. 0 Quote Link to comment Share on other sites More sharing options...
archi Posted February 28, 2012 Author Share Posted February 28, 2012 Hi laszlof. I did it yesterday. I create a file called "hooks.php" in the /includes/hooks directory. The source of the file: <?php function hook_viewcart_checkout($vars) { #$OrderID = $vars['orderid']; #$OrderNumber = $vars['ordernumber']; echo "<script type=\"text/javascript\">window.alert('ARARARARARARAR!');</script>\"; # Run code to create remote forum account here... } add_hook("PreCalculateCartTotals",1,"hook_viewcart_checkout"); ?> From the documentation about this particular hook: "PreCalculateCartTotals runs when viewing the cart summary page before checkout." But nothing is happening before/after checkout is made... Should I do something additional to make this hook working? 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.