I'm using the list of countries from this post:
http://www.ubercart.org/comment/39958/Re_Not_sure_about_list
I wanted to sort these so that an arbitrary set of countries is sorted at the top, with a separator; here is the function I used to do that, called from inside modulname_form_uc_cart_checkout_form_alter:
<?php
function _sort_countries($countries) {
$top_countries = array(
"US" =>"United States",
"GB" =>"United Kingdom",
"MX" =>"Mexico",
"JP" =>"Japan",
"DE" =>"Germany",
"FR" =>"France",
"CN" =>"China",
"CA" =>"Canada",
"BR" =>"Brazil",
);
$flipped = array_flip($top_countries);
$top = array();
$bottom = array();
foreach ($countries as $key => $country) {
if (array_key_exists($country, $flipped)) {
$top[$key] = $country;
} else {
$bottom[$key] = $country;
}
}
// we asort because things get sorted already?
arsort($top);
$merged = array_merge(array_flip($top),
array('----' => ''),
array_flip($bottom));
return array_flip($merged);
}
?>Obviously this is not sophisticated enough to allow non-devs to do custom sorting of the list via a UI, but it was sufficient for my purposes, and it may be enough to allow you to add some additional usability to your site if the vast majority of your users are from a small subset of countries.Note the various array gymnastics I had to go through in order to preserve the original array keys. =)

). It's also given me an insight into how to go about module creation...so double thanks!!
. Probably a marketing request.