Craft Posted November 16, 2020 Share Posted November 16, 2020 How to merge the 2 text fields of the domain name + TLD while purchasing a new web hosting package with an existing domain name? To allow the customers to write their existing domain at one text field only. 0 Quote Link to comment Share on other sites More sharing options...
steven99 Posted November 16, 2020 Share Posted November 16, 2020 Can't out of the box. WHMCS expects them to be separate and so at the end they need to be separate for it to work. You could use a hook that injects javascript that hides those two fields, puts a single field in its place, and on form submit separates them via the periods but would need determine between a .com and a .com.co or other such *TLDs. 0 Quote Link to comment Share on other sites More sharing options...
Craft Posted November 16, 2020 Author Share Posted November 16, 2020 51 minutes ago, steven99 said: Can't out of the box. WHMCS expects them to be separate and so at the end they need to be separate for it to work. You could use a hook that injects javascript that hides those two fields, puts a single field in its place, and on form submit separates them via the periods but would need determine between a .com and a .com.co or other such *TLDs. Do you know how to create this hook? 0 Quote Link to comment Share on other sites More sharing options...
Craft Posted November 18, 2020 Author Share Posted November 18, 2020 @brian! Could you please take a look at this topic? 🙂 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted November 19, 2020 Share Posted November 19, 2020 15 hours ago, Craft said: Could you please take a look at this topic? 🙂 you assumed that I didn't already - I read *everything*. 🙂 I didn't bother replying because I agreed with steven99's reply and his explanation as to the solution.... it seemed pretty redundant to just agree for the sake of it... although I can think of one staff member here that has (had) a habit of doing that. 😜 0 Quote Link to comment Share on other sites More sharing options...
Craft Posted November 19, 2020 Author Share Posted November 19, 2020 @brian! Ok 🙂 0 Quote Link to comment Share on other sites More sharing options...
steven99 Posted November 19, 2020 Share Posted November 19, 2020 On 11/16/2020 at 5:31 PM, Craft said: Do you know how to create this hook? Yup, I do. 😉 Oh you want instructions / the hook? A bit pressed for time so can't give a whole tested solution. Basically the hook would look like: add_hook('ClientAreaHeadOutput', 1, function($vars) { $JS = "<script> $( document ).ready(function() { $('#inputnewDomain').hide(); $('#inputnewDomainTLD').hide(); $('#inputnewDomain').parent().append(\"<input name='domainnamesidtld' id='domainnamesidtld'>\"); $( '#domainnamesidtld' ).keyup(function() { $( '#inputnewDomain' ).val($( '#domainnamesidtld' ).val() ) }); }); </script> "; return $JS; }; You'll need to find the correct IDs for the 'inputnewDomainTLD' and "inputnewDomainTLD" and change as needed. You'll also need javascript to split the domain part (sid) from the TLD and have something to check for multiple level TLDs like .com.za/au/whatever . Place within a file called domainSIDTLDcombined.php or whatever name you want and place that within /WHMCS/includes/hooks/ . With that said, personally I think it is better to have a menu for the TLD as then they can have a list of all TLDs you support as well as it prevents mistakes that can be frustrating to clients. 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.