By William Matson on Thursday, 15 May 2014
Posted in General Issues
Replies 12
Likes 0
Views 550
Votes 0
I want to rearrange the list so that the United States appears first. Where do I find the code that controls this feature?

Thanks
Hi,

Anyway I will be adding a sort option to not sort (obeys the json file) in the configuration for both address field and country field in the upcoming 1.2.16.
·
Friday, 06 June 2014 17:30
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello William,

Edit the file /administrator/components/com_easysocial/defaults/countries.json and relocate it
·
Thursday, 15 May 2014 16:48
·
0 Likes
·
0 Votes
·
0 Comments
·
Just chiming in, some day it would be cool to be able to set the default country. A lot of sites from specific regions do this. A default country doesn't necessarily mean it's pre-selected, but rather put at the top of the list to make it easy for the user to find it.
·
Thursday, 15 May 2014 16:51
·
0 Likes
·
0 Votes
·
0 Comments
·
Thanks for the heads up on this Josh
·
Friday, 16 May 2014 01:30
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Mark --

Your instruction does not work, or I misunderstand. I edited the file to place US-United States at the top of the list. However, the list still appears in alphabetical order. Please advise.
·
Friday, 16 May 2014 07:50
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi William,

Try this, open the file 'JOOMLA/media/com_easysocial/apps/fields/user/country/helper.php' and comment out below block of code start from line 78 ~ 96:


if( $sort === 'code' )
{
ksort( $countries );
}

if( $sort === 'name' )
{
asort( $countries );
}

if( $sort === 'rcode' )
{
krsort( $countries );
}

if( $sort === 'rname' )
{
arsort( $countries );
}


So your code should look like below:


// if( $sort === 'code' )
// {
// ksort( $countries );
// }

// if( $sort === 'name' )
// {
// asort( $countries );
// }

// if( $sort === 'rcode' )
// {
// krsort( $countries );
// }

// if( $sort === 'rname' )
// {
// arsort( $countries );
// }


Let me know if the above work for you or not.
Hope this help
Sam
·
Friday, 16 May 2014 13:04
·
0 Likes
·
0 Votes
·
0 Comments
·
I apologize for the late reply.

But no, your recommended edits do not work. Any other suggestions?
·
Friday, 06 June 2014 09:36
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi William,

Do you think you can pass me your FTP account and your Joomla admin access so that I can check for you?
Please advise.
Sam
·
Friday, 06 June 2014 11:25
·
0 Likes
·
0 Votes
·
0 Comments
·
OK. See site details. If possible, the United States should be first on the list. Optimally, the sort settings on the Custom Field for Address/Country should add sort by order, though this would of course require the web administrator to modify the countries.json file.

Thanks
·
Friday, 06 June 2014 13:48
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi,

Hmm I tried loading the country field and United States is already appearing at the top of the list.

If you are referring to the address field, then you will have to comment out codes at /media/com_easysocial/apps/fields/user/address/helper.php line 40 to 46.

Also, do clear your Gantry cache after modifying your file.
·
Friday, 06 June 2014 17:14
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi Jason --

Thanks for your help. It did not occur to me to clear the gantry cache. Will do so regularly from now on.

That sort option in ES 1.2.16 would be very valuable. Allows us flexibility. Josh Lewis, in his comment above, made an excellent suggestion.

Thanks
·
Saturday, 07 June 2014 05:58
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi,

Noted and we are hoping to be able to include a revamp on this part in 1.3. Hopefully we are able to finish it in time. Finger crossed.
·
Saturday, 07 June 2014 10:02
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post