pjs32 Posted October 7, 2020 Share Posted October 7, 2020 Hi, Would anyone know how to remove these fields when clients transfer in their UK domains? as they should not be required - as the registrant name/legal type are not updated when the transfer happens. We are using the Nominet module. 0 Quote Link to comment Share on other sites More sharing options...
pjs32 Posted October 8, 2020 Author Share Posted October 8, 2020 Thank you Brian! I have tried your hook and it remove the fields, but when pressing continue, up comes this error 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted October 8, 2020 Share Posted October 8, 2020 1 minute ago, pjs32 said: I have tried your hook and it remove the fields, but when pressing continue, up comes this error lol I never thought to press continue - that's WHMCS Testing Dept level of competence on my part... apologies. 🙄 that being the case, I think you have two options - remove the requirement of that field from the ADF (following the instructions to create a custom file etc) - though that could lead to the field not being filled during registrations (without more coding to make it required), or I modify the hook to insert a dummy value into that required field. which way do you want to go? 0 Quote Link to comment Share on other sites More sharing options...
pjs32 Posted October 8, 2020 Author Share Posted October 8, 2020 3 minutes ago, brian! said: lol I never thought to press continue - that's WHMCS Testing Dept level of competence on my part... apologies. 🙄 that being the case, I think you have two options - remove the requirement of that field from the ADF (following the instructions to create a custom file etc) - though that could lead to the field not being filled during registrations (without more coding to make it required), or I modify the hook to insert a dummy value into that required field. which way do you want to go? Hi Brian! This would be good,if you could do.. or I modify the hook to insert a dummy value into that required field. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted October 8, 2020 Share Posted October 8, 2020 (edited) 2 hours ago, pjs32 said: I modify the hook to insert a dummy value into that required field. the hook itself is simple enough - tweak the Reg Name field with a dummy value and make it hidden... but I can't think of an obvious way in the hook to hide the fieldname... aaagh! I can't rename it as it's a required field - and even if I could, there's a colon hardcoded in the template... hiding via css would be tricky as there could be registrations and transfers on the same page... so I think the simplest solution for now is a hook that does the donkey work of the array manipulation and a simple Smarty if statement in the configuredomains.tpl template. <?php # Nominet Transfer ADF Hook v2 # Written by brian! function nominet_transfer_adf_hook($vars) { if ($vars['templatefile']=='configuredomains'){ $domains = $vars['domains']; foreach ($domains as $key => $domain) { $tld = substr($domain['domain'],strrpos($domain['domain'],".")); if ($_SESSION['cart']['domains'][$key]['type'] == "transfer" && $tld == ".uk") { $domains[$key]['type'] = 'transfer'; foreach ($domain['fields'] as $fieldkey => $value) { if ($fieldkey == 'Registrant Name') { $domains[$key]['fields']['Registrant Name'] = str_replace('value=""','value="dummy"',$value); $domains[$key]['fields']['Registrant Name'] = str_replace('type="text"','type="hidden"',$domains[$key]['fields']['Registrant Name']); } else { unset($domains[$key]['fields'][$fieldkey]); } } } } return array("domains" => $domains); } } add_hook("ClientAreaPageCart", 1, "nominet_transfer_adf_hook"); and then in the template... <div class="col-sm-4">{$domainfieldname}:</div> becomes... <div class="col-sm-4">{if $domain.type neq 'transfer'}{$domainfieldname}:{/if}</div> Edited October 8, 2020 by brian! 0 Quote Link to comment Share on other sites More sharing options...
pjs32 Posted October 8, 2020 Author Share Posted October 8, 2020 (edited) Hi Brian, Unfortunately when you press the last continue button, up comes the error again Edited October 8, 2020 by pjs32 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted October 8, 2020 Share Posted October 8, 2020 3 minutes ago, pjs32 said: Unfortunately when you press the last continue button, up comes the error again *sighs* - I tidied up the code too much before posting it... $domains[$key]['fields']['Registrant Name'] = str_replace('type="text"','type="hidden"',$value); should be... $domains[$key]['fields']['Registrant Name'] = str_replace('type="text"','type="hidden"',$domains[$key]['fields']['Registrant Name']); the way I had it, only the second line would work - third time lucky. 🙏 0 Quote Link to comment Share on other sites More sharing options...
pjs32 Posted October 8, 2020 Author Share Posted October 8, 2020 Thanks very much Brian - that works a treat! 😀 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.