MJHost Posted July 14, 2019 Share Posted July 14, 2019 Hi all, I am looking to add an additional checkbox to the order process. This would only appear if a domain name was being purchased as part of the order. I have the hook for the "additional checkbox". Is it possible to edit this, so that it only appears when a domain is in the "basket" too? 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted July 14, 2019 Share Posted July 14, 2019 5 hours ago, MJHost said: I am looking to add an additional checkbox to the order process. This would only appear if a domain name was being purchased as part of the order. I have the hook for the "additional checkbox". Is it possible to edit this, so that it only appears when a domain is in the "basket" too? i'd be tempted to say yes, because you should just need to search the $session cart value and see if there is a domain reg/tran in there - probably at the ShoppingCartValidateCheckout stage... it's too late to look at coding tonite (especially after 11 hours watching cricket), but with a refreshed mind tomorrow, things should be clearer to me (and i've bookmarked the thread). 🏏 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted July 15, 2019 Share Posted July 15, 2019 i'm assuming two things with this answer... you are referring to John's hook from the thread below.... when you say "This would only appear if a domain name was being purchased as part of the order.", i'm including both domain registrations and transfers in that - if it registrations only you want to check for and not transfers, then that would require additional coding... somewhere in those 3 existing IF statements, you should just need to add... if ($vars['domainsinorder'] != 'true') { return false; } the value should be true if it's a reg or transfer, false if owndomain, subdomain or no domains in the cart. 0 Quote Link to comment Share on other sites More sharing options...
MJHost Posted July 15, 2019 Author Share Posted July 15, 2019 20 hours ago, brian! said: i'd be tempted to say yes, because you should just need to search the $session cart value and see if there is a domain reg/tran in there - probably at the ShoppingCartValidateCheckout stage... it's too late to look at coding tonite (especially after 11 hours watching cricket), but with a refreshed mind tomorrow, things should be clearer to me (and i've bookmarked the thread). 🏏 Thank you @brian! - Hope you enjoyed the cricket, I unfortunately missed it. 3 hours ago, brian! said: i'm assuming two things with this answer... you are referring to John's hook from the thread below.... when you say "This would only appear if a domain name was being purchased as part of the order.", i'm including both domain registrations and transfers in that - if it registrations only you want to check for and not transfers, then that would require additional coding... somewhere in those 3 existing IF statements, you should just need to add... if ($vars['domainsinorder'] != 'true') { return false; } the value should be true if it's a reg or transfer, false if owndomain, subdomain or no domains in the cart. That's great, yes, I did mean transfers too. 0 Quote Link to comment Share on other sites More sharing options...
MJHost Posted July 16, 2019 Author Share Posted July 16, 2019 Me again 😕 Added the code into the additionalAgreement.php hook file. if ($vars['domainsinorder'] != 'true') { return false; It is currently just below: if ($vars['filename'] != 'cart') { return false; It hasn't worked (or atleast it doesn't appear to have done). The additional checkbox and text is not showing in the checkout process, whether a domain is in the cart or not. Have I entered it into the wrong place? 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted July 17, 2019 Share Posted July 17, 2019 15 hours ago, MJHost said: It hasn't worked (or atleast it doesn't appear to have done). The additional checkbox and text is not showing in the checkout process, whether a domain is in the cart or not. Have I entered it into the wrong place? no - if I do the same, then it works... the only difference I made, which is trivial and shouldn't affect it working, was to remove that 3rd hook as it's redundant (unless you change the coding to get it to do something). as it's just a boolean value, you could use the following alternatives instead and see if that works for you.. if ($vars['domainsinorder'] != '1') { return false; } if it doesn't, then you'll need to add the debug code to the end of the checkout.tpl template and check the popup window to see if the variable exists in your setup... {if $adminLoggedIn}{debug}{/if} 0 Quote Link to comment Share on other sites More sharing options...
MJHost Posted July 17, 2019 Author Share Posted July 17, 2019 6 hours ago, brian! said: no - if I do the same, then it works... the only difference I made, which is trivial and shouldn't affect it working, was to remove that 3rd hook as it's redundant (unless you change the coding to get it to do something). as it's just a boolean value, you could use the following alternatives instead and see if that works for you.. if ($vars['domainsinorder'] != '1') { return false; } if it doesn't, then you'll need to add the debug code to the end of the checkout.tpl template and check the popup window to see if the variable exists in your setup... {if $adminLoggedIn}{debug}{/if} I tried the alternative, but that made no difference. But on closer inspection of the checkout process, I noticed that the gatewaylogos.php hook as stopped functioning. So I am thinking something is stopping the hooks working? I also note, that I seem to have two "hooks" folders, one inside /includes/ (which is where the additional terms and gateway logo hooks are) and then there is another in the main directory. Is this correct? 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted July 18, 2019 Share Posted July 18, 2019 (edited) 16 hours ago, MJHost said: I tried the alternative, but that made no difference. But on closer inspection of the checkout process, I noticed that the gatewaylogos.php hook as stopped functioning. So I am thinking something is stopping the hooks working? it should be triggering automatically - looking at your site, the PayPal logo is in the correct folder, so I don't know why it wouldn't show the logo (unless the hook isn't being triggered)... but the two hooks can work happily together... 16 hours ago, MJHost said: I also note, that I seem to have two "hooks" folders, one inside /includes/ (which is where the additional terms and gateway logo hooks are) and then there is another in the main directory. Is this correct? there should only be one hooks folder, located inside the 'includes' folder... the one inside the main folder is not a default part of WHMCS - maybe it's being used by an addon.... but any hooks in there won't be triggered by a page load... the ones in /includes/hooks/ should be though. Edited July 18, 2019 by brian! 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.