gcphost Posted February 27, 2011 Share Posted February 27, 2011 Hi How do you change the default country selected on the users profile/order form? I find many users are marked as fraud because they didnt bother to change their country - if it wasnt selected as USA by default - this would not be a problem I looked at the code <td>{if $loggedin}{$clientsdetails.country}{else}{$clientcountrydropdown}{/if}</td> Is there a place to edit $clientcountrydropdown? I did not yet look as this thing is encoded. Thanks. 0 Quote Link to comment Share on other sites More sharing options...
WHMCS Support Manager WHMCS John Posted February 28, 2011 WHMCS Support Manager Share Posted February 28, 2011 Setup > General Settings > Localisation tab. 0 Quote Link to comment Share on other sites More sharing options...
gcphost Posted February 28, 2011 Author Share Posted February 28, 2011 Hi Thats great but it does not allow for "no" selection. I dont want any default at all - blank - making it 100% required that the user select it. I see about 10% of all orders getting picked with the default country - on accident - as the rest of the info is proper. 0 Quote Link to comment Share on other sites More sharing options...
gcphost Posted March 2, 2011 Author Share Posted March 2, 2011 Basic idea - copy/paste the html and over-right the variable generated field (as that cant be edited, boo) Works well now, would recommend not selecting a default country - or making it an option - it increases chance of fraud having it auto-selected 0 Quote Link to comment Share on other sites More sharing options...
sparky Posted March 2, 2011 Share Posted March 2, 2011 There is a way to do it open includes/countries.php and add this line to the top within the array ""=>"Select Country", eg.. <?php $countries = array( ""=>"Select Country", "AF"=>"Afghanistan", "AX"=>"Aland Islands", "AL"=>"Albania", "DZ"=>"Algeria", <<<SNIP>>> Go to admin->setup->general settings->localisation and select "Select Country" as the default. Now create a file in your includes hooks directory called "country_validation.php" and put this code within it <?php if (!defined("WHMCS")) die("This file cannot be accessed directly"); function check_country($vars) { global $errormessage,$_LANG; if ($vars["country"] == "Select Country" || $vars["country"] == "") { $errormessage.="<li>".$_LANG['clientareaerrorcountry']; } } add_hook("ClientDetailsValidation",1,"check_country",""); ?> 0 Quote Link to comment Share on other sites More sharing options...
gcphost Posted March 2, 2011 Author Share Posted March 2, 2011 you tha man! way better then my hack! gg worth 10,00 credits (hah) 0 Quote Link to comment Share on other sites More sharing options...
sparky Posted March 2, 2011 Share Posted March 2, 2011 Your welcome... maybe you could PM bear and ask him to move this thread to "Tips & Tricks" 0 Quote Link to comment Share on other sites More sharing options...
sohouk Posted March 2, 2011 Share Posted March 2, 2011 In general, 90% of our clients are from two specific countries, and one region. These are: The UK The US Europe One thing we have done since first using WHMCS, (and your post reminded me of it) is to trim down the Countries list to something more meaningful. As a user, I hate having to scroll through endless lists to just find the item I want, and I feel certain our clients do as well. WHMCS simple solution You can simply trim the countries list (/includes/countries.php) by deleting countries you don’t need from the countries.php file(to be honest, there were many I have never heard of). As mentioned, the file is in the /includes folder. Delete any countries you want, keeping the lines clean. Just remember that the last entry does not have a comma after it and each entry line ends with a semi-colon ; (as its php!) That helps a lot, but I also wanted to put our most common country (the UK) first. Now the problem here is that every time the countries.php file is called to deliver its content, it sorts itself. Thats good for most, but not for our requirement when we want to make sure a certain entry appears first. One way to stop this and make sure the entry you want is at the top is to simply comment out the penultimate line: asort($countries); No need to delete it, just comment it out with a couple of slashes like this: //asort($countries); Now, the list is served up in the order of entries in the file without sorting. This means you can promote the default value to the top of the list The way Sparky has done it is far better, and addresses a slightly different scenario, but for a very simple and easy modification, editing the countries.php file is quick and easy. As always, backup your files first! Trevor 0 Quote Link to comment Share on other sites More sharing options...
sparky Posted March 2, 2011 Share Posted March 2, 2011 True... you can edit the countries.php file to remove the ones that you don't want... but what if you happen to get a client that is not within the country list that you have available and when they place an order the fraud module, maxmind in my case will mark the order as fraud because the potential and legit client can not pass the fraud test because he/she can't select their country. Sometimes altering a simple thing can have consequenses somewhere else. I don't know if anyone else remembers but the "Select Country" line was in an early V3 of whmcs... not sure why it was removed. 0 Quote Link to comment Share on other sites More sharing options...
sohouk Posted March 2, 2011 Share Posted March 2, 2011 You are correct in saying what you do about clients in countries that may be deleted. However, for our purposes we would probably flag a lot of countries as fraudulent orders ourselves, even if MaxMind doesn’t! As I mentioned, there are a whole range of countries I have never even heard of Trevor 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.