alturic Posted April 9, 2015 Share Posted April 9, 2015 <?php function create_store($OrderID, $OrderNumber, $InvoiceID, $Products, $Addons, $Domains) { echo"<pre>"; print_r($OrderID); print_r($OrderNumber); print_r($InvoiceID); print_r($Products); print_r($Addons); print_r($Domains); echo"</pre>"; } add_hook("AfterShoppingCartCheckout",1,"create_store",""); ?> Unless I'm misunderstanding what should happen here (I don't think I am simply do to "where else will these echo", the user should get this echo'ed to them upon checkout, right? I have a file in includes/hooks called blah.php and nothing happens at checkout, anywhere. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted April 9, 2015 Share Posted April 9, 2015 i'm not sure in the AfterShoppingCartCheckout hook got deprecated - it's not on the list of hooks below... http://docs.whmcs.com/Hooks:Alphabetical http://forum.whmcs.com/showthread.php?94566-Is-the-AfterShoppingCartCheckout-hook-still-supported 0 Quote Link to comment Share on other sites More sharing options...
sentq Posted April 9, 2015 Share Posted April 9, 2015 the right format is like that: function create_store($vars) { $orderID = $vars['orderid']; $orderNumber = $vars['order_number']; } add_hook("AfterShoppingCartCheckout",1,"create_store"); - - - Updated - - - i'm not sure in the AfterShoppingCartCheckout hook got deprecated - it's not on the list of hooks below... http://docs.whmcs.com/Hooks:Alphabetical http://forum.whmcs.com/showthread.php?94566-Is-the-AfterShoppingCartCheckout-hook-still-supported not quite sure, i didn't saw it on the list too, but the documentation exist, and with no mention to deprecation or so http://docs.whmcs.com/Hooks:AfterShoppingCartCheckout 0 Quote Link to comment Share on other sites More sharing options...
alturic Posted April 9, 2015 Author Share Posted April 9, 2015 Let me explain what I'm looking to do and you guys give me input on which hook you'd use. So I have a script that will add a user to our forum. Great, if it was for all users we can use anything, BUT what all vars can you pull? Example, I only want it to fire if the order has been paid and only if one of the $products has a Yes for a configoptions optionname, so I was thinking of doing the hook for accept order because we'd only accept an order if the invoice is paid. Also, if I did hook it to accept order, would I have to do foreach's for when/if we bulk approve orders? Or do these hooks fire once for each order if bulk "accept order"ing? - - - Updated - - - Oh, and i dont have to include hooks in the hooks dir, right? Whmcs will always include all files in there? 0 Quote Link to comment Share on other sites More sharing options...
sentq Posted April 9, 2015 Share Posted April 9, 2015 hook actions will run once per order so you don't need the foreach part if you need to create forum account for client when they order (and pay) for the first time, you may need to use InvoicePaid action hook, you can first check if the account created before (in forum DB) if not create it then. http://docs.whmcs.com/Hooks:InvoicePaid - - - Updated - - - Oh, and i dont have to include hooks in the hooks dir, right? Whmcs will always include all files in there? all files in /includes/hooks folder called automatically by WHMCS, you job is to write the right syntax and let WHMCS handle it 0 Quote Link to comment Share on other sites More sharing options...
WHMCS Support Manager WHMCS John Posted April 10, 2015 WHMCS Support Manager Share Posted April 10, 2015 Hi, I can confirm the AfterShoppingCartCheckout hook point does exist: http://docs.whmcs.com/Hooks:AfterShoppingCartCheckout 0 Quote Link to comment Share on other sites More sharing options...
alankis Posted October 28, 2015 Share Posted October 28, 2015 Yes, documentation states that it exist, but my test hook doesn't run. Can anybody confirm that this hooks exists or not? - - - Updated - - - Another in depth test confirms that hook actually exist. 0 Quote Link to comment Share on other sites More sharing options...
alankis Posted October 28, 2015 Share Posted October 28, 2015 How can I access AfterShoppingCartCheckout variables, for example 'orderid' or 'orderdomainsid'? I have created 'myaddon' addon, activated in admin backend, created myaddon.php and hooks.php files, with following code in hooks.php file: <?php /** * * TEST HOOK * */ function hook_MyAddonOrderTest($vars) { //print_r($params); mail('me@domain.com', 'test', $vars['orderid']); } add_hook("AfterShoppingCartCheckout", 1, "hook_MyAddonOrderTest"); I have tested and hook runs normally, I receive mail, but I can't access any of avaliable variables, according to docs. Is there any chance to access hook related variables inside hook, or I am doing something wrong? Any help would be appreciated. Thanks, Alan 0 Quote Link to comment Share on other sites More sharing options...
sentq Posted October 30, 2015 Share Posted October 30, 2015 I see that you know how to get the orderid, so what exactly do you mean by accessing any of the variables? 0 Quote Link to comment Share on other sites More sharing options...
alankis Posted October 30, 2015 Share Posted October 30, 2015 Hi, sentq I figured it out. It seems that documentation for AfterShoppingCartCheckout is outdated. Full list of avaliable variables is as follows: Array ( [OrderID] => 36 [OrderNumber] => 1093359502 [serviceIDs] => Array ( ) [DomainIDs] => Array ( ) [AddonIDs] => Array ( ) [RenewalIDs] => Array ( ) [PaymentMethod] => [invoiceID] => [TotalDue] => [Products] => Array ( ) [Domains] => Array ( ) [Addons] => Array ( ) [Renewals] => Array ( ) ) 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.