Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

How to set the Country to your own country as the default option in create account?


webgurl2006

Recommended Posts

As there are so many countries in the drop-down box when you are creating a new account, can you set a specific country to be the default option, rather than having to locate your own country?

 

<td class="main"><?php echo ENTRY_COUNTRY; ?></td>

<td class="main"><?php echo tep_get_country_list('country') . ' ' . (tep_not_null(ENTRY_COUNTRY_TEXT) ? '<span class="inputRequirement">' . ENTRY_COUNTRY_TEXT . '</span>': ''); ?></td>

 

Also, where is the country list stored... includes > modules > shipping > usps.php?

Link to comment
Share on other sites

As there are so many countries in the drop-down box when you are creating a new account, can you set a specific country to be the default option, rather than having to locate your own country?

 

<td class="main"><?php echo ENTRY_COUNTRY; ?></td>

<td class="main"><?php echo tep_get_country_list('country') . ' ' . (tep_not_null(ENTRY_COUNTRY_TEXT) ? '<span class="inputRequirement">' . ENTRY_COUNTRY_TEXT . '</span>': ''); ?></td>

 

Also, where is the country list stored... includes > modules > shipping > usps.php?

 

the countries are listed in the database - in the countries table

the function is in include/functions/html_output.php :

// Creates a pull-down list of countries
 function tep_get_country_list($name, $selected = '', $parameters = '') {

 

which calls this :

// Returns an array with countries
// TABLES: countries
 function tep_get_countries($countries_id = '', $with_iso_codes = false) {
$countries_array = array();

 

you could delete all the countries you don't want.

 

also you could put a condition in the select query :

select countries_id, countries_name from " . TABLE_COUNTRIES . " where countries_name in ('CA','USA','AU','UK') order by countries_name

 

whatever you want to list.

 

You can change the pull down default here :

includes/languages/english.php

define('PULL_DOWN_DEFAULT', 'United States');

 

david

Link to comment
Share on other sites

I tried that and where I could remove all the countries and (which is not what I want) , I could also make a specific country appear in the drop down , you still have to go down the list to select the country.

 

Hope that makes sense!

 

Error says: You must select a country from the Countries pull down menu.

Link to comment
Share on other sites

Open /catalog/includes/functions/html_output.php and change this bit of code:

 

$countries_array = array(array('id' => '', 'text' => PULL_DOWN_DEFAULT));

 

to this:

 

$countries_array = array(array('id' => '223', 'text' => 'United States'));

 

Swop out the values with your own if you want a country other than USA to display first.

Link to comment
Share on other sites

I am guessing id => 223 relates to states of the USA.

 

I added this instead:

 

$countries_array = array(array('text' => 'Australia'));

 

Still get the error asking for the country to be selected so I guess somewhere else I have to customise.

 

So far I have altered:

 

/includes/languages/english.php........

 

// pull down default text

define('PULL_DOWN_DEFAULT', 'Australia');

 

/includes/functions/html_output.php

$countries_array = array(array('text' => 'Australia'));

Link to comment
Share on other sites

I am guessing id => 223 relates to states of the USA.

The USA doesn't have 223 states... It's big - but not that big :)

 

223 is the id number of the USA in the COUNTRIES database table. To use Australia you have to insert the ID number for Oz.

 

You don't need to change that bit of code in /languages/english/

 

To see the code in action - go here:

 

https://lakersstore.com/create_account.php

 

Where United States is displayed as the first country.

Link to comment
Share on other sites

  • 4 months later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...