krypton-media Posted March 6, 2021 Share Posted March 6, 2021 Hello, until the update to the current version 8.1.3, the query of the user-defined customer fields also worked for me in the order overview. Although these are marked as mandatory, they are now no longer queried. Only the terms and conditions are always queried by default Is this error known and how can it be solved? Best regards Christian 0 Quote Link to comment Share on other sites More sharing options...
krypton-media Posted March 7, 2021 Author Share Posted March 7, 2021 I have now tried to create a hook to extend the query, e.g. when registering a customer. However, I do not know how to act on the missing entries. Currently I just write something in $errors but that doesn't work so that it queries the fields additionally. clientregister.tpl <div class="row"> <div class="col-sm-1" style="text-align:right"> <input type="checkbox" name="accepttos" id="accepttos" /> </div> <div class="col-sm-11" style="text-align:left"> {$LANG.ordertosagreement} <strong><a href="{$tosurl}" target="_blank">{$LANG.ordertos}</a></strong> </div> </div> <div class="row"> <div class="col-sm-1" style="text-align:right"> <input type="checkbox" name="widerruf" id="widerruf" /> </div> <div class="col-sm-11" style="text-align:left"> {$LANG.ordercancellationpolicyagreement} <strong><a href="{$WEB_ROOT}cancellationpolicy.php" target="_blank">{$LANG.ordercancellationpolicy}</a></strong> </div> </div> <div class="row"> <div class="col-sm-1" style="text-align:right"> <input type="checkbox" name="datenschutz" id="datenschutz" /> </div> <div class="col-sm-11" style="text-align:left"> {$LANG.orderprivacypolicyagreement} <strong><a href="{$WEB_ROOT}privacypolicy.php" target="_blank">{$LANG.orderprivacypolicy}</a></strong> </div> </div> ClientRegister.php ( includes/hooks/) <?php add_hook('ClientAreaRegister', 1, function($vars) { global $_LANG; $errors = array(); if ( $_REQUEST['widerruf'] != true ) { $errors[] = $_LANG['ordercancellationpolicy']; } if ( $_REQUEST['datenschutz'] != true ) { $errors[] = $_LANG['orderprivacypolicy']; } return $errors; }); 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted March 9, 2021 Share Posted March 9, 2021 On 06/03/2021 at 22:31, krypton-media said: Is this error known and how can it be solved? I can't recall anyone else mentioning it. one thing that I am confused about is whether you are using Client Custom Fields for this as the second screenshot implies ? if so, required fields are needing to be completed when I test this locally... the point being that if these were customfields, then WHMCS should take care of checking that they're required.... if that's the case, what happens when you try this on an unmodified Six template (i'm assuming you're using a custom version of Six) ? 0 Quote Link to comment Share on other sites More sharing options...
krypton-media Posted March 10, 2021 Author Share Posted March 10, 2021 Quote if so, required fields are needing to be completed when I test this locally... this is how it should be, but it doesn't work Quote what happens when you try this on an unmodified Six template (i'm assuming you're using a custom version of Six) I will try it and yes I have a modified version. 0 Quote Link to comment Share on other sites More sharing options...
krypton-media Posted March 11, 2021 Author Share Posted March 11, 2021 Hello, I have now tried this again with the standard template six. I created two new custom fields and made them mandatory during the order process. However, as can be seen in the error message, only the general terms and conditions are requested. It is enough if I accept them. The other two fields do not have to be clicked. With kind regards Christian 0 Quote Link to comment Share on other sites More sharing options...
krypton-media Posted March 12, 2021 Author Share Posted March 12, 2021 In the customer profile, of course, these fields also stand out and work there. You can see this in the error message if you do not activate the checkboxes. 0 Quote Link to comment Share on other sites More sharing options...
krypton-media Posted March 12, 2021 Author Share Posted March 12, 2021 Is there perhaps a hook with which you can include additional fields that must be clicked? This function is mandatory in Germany, otherwise you can be legally prosecuted. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted March 22, 2021 Share Posted March 22, 2021 Hi Christian, On 11/03/2021 at 19:03, krypton-media said: I have now tried this again with the standard template six. I created two new custom fields and made them mandatory during the order process. However, as can be seen in the error message, only the general terms and conditions are requested. It is enough if I accept them. The other two fields do not have to be clicked. if setup and used correctly, the page requires them if a user isn't yet registered/logged in... if the user is logged in, then I don't think any custom fields are validated or even the TOS field... I think that's intended behaviour - though I would dispute that these are really custom fields in the way you're using them at checkout... if that's the case, their values won't be saved to the database. On 12/03/2021 at 13:43, krypton-media said: Is there perhaps a hook with which you can include additional fields that must be clicked? This function is mandatory in Germany, otherwise you can be legally prosecuted. assuming the above code you're using is still in the template, e.g you are hardcoding checkboxes and not using custom fields in the true sense... <?php # Validate Checkbox Fields @ Checkout Hook # Written by brian! use App; add_hook('ShoppingCartValidateCheckout', 1, function ($vars) { $widerruf = App::getFromRequest('widerruf'); $datenschutz = App::getFromRequest('datenschutz'); if (!$widerruf && !$datenschutz) { return ['You must confirm you agree to the Cancellation Policy','You must confirm you agree to the Data Protection Policy']; } elseif (!$widerruf) { return 'You must confirm you agree to the Cancellation Policy'; } elseif (!$datenschutz) { return 'You must confirm you agree to the Data Protection Policy'; } }); you probably should be returning language strings instead of the quote English/German errors, but I assume you know how to do that (once you've written the appropriate language strings for each error in all languages used).... return Lang::trans('ordererroraccepttos'); if you were *really* using custom fields at checkout for this, then the code should still work - you would just have to adjust the getfromrequest values to the names of the fields. 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.