Jump to content

Hooks and internal API use in cart (clients' side)' side)


archi

Recommended Posts

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.

Link to comment
Share on other sites

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?

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