luigidefra Posted November 16, 2020 Share Posted November 16, 2020 how require clients to accept policy like as terms and conditions? 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted November 16, 2020 Share Posted November 16, 2020 are you talking of TOS Acceptance or something more specific to a product ? https://docs.whmcs.com/Ordering_Tab#Enable_TOS_Acceptance 0 Quote Link to comment Share on other sites More sharing options...
Kian Posted November 16, 2020 Share Posted November 16, 2020 If I understood correctly, you need two checkboxes. One for TOS and one for Privacy Policy. That's pretty common in EU. In Italy it is mandatory (I suppose you're italian). The thing is that WHMCS doesn't support multiple checkboxes but you can solve the problem with javascript. Edit the following files: templates/{YOUR_TEMPLATE}/clientregister.tpl templates/orderforms/{YOUR_CART}/checkout Add two dummy checkboxes (for TOS & Privacy) and make them required. Let's call them A and B. Then hide the checkbox of WHMCS. Let's call it C. Lastly, create a javascript that: Ticks C when A and C have been selected Unticks C when the above condition is false 1 Quote Link to comment Share on other sites More sharing options...
Hein Posted November 21, 2020 Share Posted November 21, 2020 You can also add an extra tickbox (or multiple even) by adding a hook for it. What we use for this is the following and it should work all the way up to the latest version of WHMCS, and even in V8, but test carefully as always 🙂 (change readextrarequirements and extra_requirements to something more useful, espcially if you are using multiple different ones) <?php /** * Example hook to provide an additional agreement requirement in checkout. * * @copyright Copyright (c) WHMCS Limited 2018 * @license https://www.whmcs.com/eula/ WHMCS Eula */ use App; add_hook('ClientAreaFooterOutput', 1, function ($vars) { if (!defined('CLIENTAREA')) { return false; } if ($vars['filename'] != 'cart') { return false; } $a = App::getFromRequest('a'); if (!in_array($a, array('view', 'checkout'))) { return false; } $readextrarequirements = App::getFromRequest('extra_requirements'); $output = '<div class="text-center"> <label class="checkbox-inline"> <input type="checkbox" name="extra_requirements" value="1"' . ($readextrarequirements ? ' checked':'') . ' /> I have read, agree and can comply with any applicable specific requirements. If you can not, please contact us Before placing any order to discuss the options. </label> </div> <br />'; return '<script> jQuery("#btnCompleteOrder").before("' . preg_replace( "/\r|\n/", "", str_replace('"', '\"', $output)) . '"); </script>'; }); add_hook('ShoppingCartValidateCheckout', 1, function ($vars) { $readextrarequirements = App::getFromRequest('extra_requirements'); if (!$readextrarequirements) { return 'You must confirm you read and agree with the requirements'; } }); add_hook('AfterShoppingCartCheckout', 1, function ($vars) { $orderId = $vars['OrderID']; $readextrarequirements = App::getFromRequest('extra_requirements'); if ($readextrarequirements) { // Run any additional code post checkout here // For example logging of the agreement, time, IP, etc... } }); 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted November 21, 2020 Share Posted November 21, 2020 4 minutes ago, Hein said: You can also add an extra tickbox (or multiple even) by adding a hook for it. for the record, the original source of that hook code... 0 Quote Link to comment Share on other sites More sharing options...
Hein Posted November 24, 2020 Share Posted November 24, 2020 (edited) Thanks Brian ... I Truly didn't remember where we got it and always Want to give credit where it is due..:-) Edited November 24, 2020 by Hein 0 Quote Link to comment Share on other sites More sharing options...
krypton-media Posted March 12, 2021 Share Posted March 12, 2021 Hello, is there a possibility to include variables for the different language files in the php files under /include/hooks? How would one have to do this? 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.