RObW Posted April 26, 2004 Posted April 26, 2004 The Wiki Documentation gives two suggestions for pre-selecting the Country. The second option is great, but it means that if the customer submits the form and there are errors, the country reverts to the default. This can lead to customers getting frustrated if they don't realise the country changed again... So, instead of the code in the documentation, use this: catalog/create_account.php about line 442 Find: echo tep_get_country_list('country') Instead Replace With: if (!isset($country)) $country='222'; echo tep_get_country_list('country') Where 222 is the UK Country Code (replace with your desired country code). The dropdown is now only set the first time, and not reset after that! Cheers Rob
molafish Posted April 29, 2004 Posted April 29, 2004 good stuff. But keep in mind you should also be doing this replacement in /includes/modules/checkout_new_address.php about line 93 This will allow the address update routines in checkout_payment_address.php and checkout_shipping_address.php to have the same functionality. The other file listed by the wiki doc you mentioned, address_book_process.php, seems an unnecessary replacement due to the fact that javascript is error checking the form and the page will not reload (and consequently not reset the country value) on a duplicate acount error. But if you must edit this file, take care to keep the "$entry['entry_country_id']" in "tep_get_country_list('country', $entry['entry_country_id'])" i.e. replace echo tep_get_country_list('country', $entry['entry_country_id']) with if (!isset($country)) $country='223'; echo tep_get_country_list('country', $entry['entry_country_id']) where '223' is your desired default country code... I have also taken the ball and ran with it for the State field, because it falls victim to the same problems, so this would involve replacing the following text in the same files (scroll up about 10 lines): replace echo tep_draw_pull_down_menu('state', $zones_array); with echo tep_draw_pull_down_menu('state', $zones_array, $zones_array[$zone_id - 1]['id']); Now if an error brings the user back to the entry page with something like "There is already a user with that email account," both the State and Country fields will not have reset to their default values. Thus relieving precious customer frustration
stevel Posted May 2, 2004 Posted May 2, 2004 Also take a look at my Country-State Selector contribution, which handles this and related issues more cleanly. Steve Contributions: Country-State Selector Login Page a la Amazon Protection of Configuration Updated spiders.txt Embed Links with SID in Description
scranmer Posted December 14, 2005 Posted December 14, 2005 Just edit includes\functions\html_output.php and amend the following bit to default ALL country LOVs to your shops country. HTH Si. //// // Creates a pull-down list of countries function tep_get_country_list($name, $selected = '', $parameters = '') { //**si** if ( strlen($selected)==0 ) $selected = STORE_COUNTRY; //**si** $countries_array = array(array('id' => '', 'text' => PULL_DOWN_DEFAULT)); $countries = tep_get_countries(); for ($i=0, $n=sizeof($countries); $i<$n; $i++) { $countries_array[] = array('id' => $countries[$i]['countries_id'], 'text' => $countries[$i]['countries_name']); } return tep_draw_pull_down_menu($name, $countries_array, $selected, $parameters); }
Recommended Posts
Archived
This topic is now archived and is closed to further replies.