Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Default Country


DataMouse

Recommended Posts

Hi all

 

I have a store that only sells to one country (the UK).

I have the admin all set up fine, with only UK allowed.

 

The issue I'm having is that the create account and payment screens have the country field removed from the structure (as it's not required - it's always the same).

 

This is great except when someone wants to use WorldPay (RBS), which asks for the country.

 

Is there a way of submitting a default country for this?

 

I'm sure it's simple, but can;t find it :-(

 

Danny

Link to comment
Share on other sites

Hi all

 

I have a store that only sells to one country (the UK).

I have the admin all set up fine, with only UK allowed.

 

The issue I'm having is that the create account and payment screens have the country field removed from the structure (as it's not required - it's always the same).

 

This is great except when someone wants to use WorldPay (RBS), which asks for the country.

 

Is there a way of submitting a default country for this?

 

I'm sure it's simple, but can;t find it :-(

 

Danny

First, you can delete all other countries from the database if you want. While you are there get the ID number for the UK. You will need it in the next step.

 

Then, open up /catalog/includes/functions/html_output.php and find the last few lines of the file.

 

// Creates a pull-down list of countries
 function tep_get_country_list($name, $selected = '223', $parameters = '') {
   $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);
 }
?>

The USA has a code of '223' change that to the code you found for the UK.

Community Bootstrap Edition, Edge

 

Avoid the most asked question. See How to Secure My Site and How do I...?

Link to comment
Share on other sites

Not sure if I am on the same page with you but have you considered instead of the country select list change it to a hidden field with your country code as the field value so your single country solution is still processed but without having to bother your users with the selection.

How do you know when you know what you want to do for the rest of your life?

Link to comment
Share on other sites

mdtaylorlrim - Thanks for the info

 

Masat - that sounds just about right.

I've deleted the countries from my database and have only one records for the UK.

I customised the store heavily and removed teh dropdown as it was one less thing for peeps to click/select.

 

Now, it seems that RBS need the country field sending across :(

Link to comment
Share on other sites

I would recommend to NEVER delete but instead just comment code out then only after thorough testing go back and clean up.

 

I have always hated leaving all those countries in the database and the same for the zones but at some point I have always had issues especially when I would like to use them for something else.

 

My solution was to add an active field to the database tables and then mod the select list function to only select the active countries and zones.

 

In a few of the carts I have put up I simply slipped the country code into the form process area.

How do you know when you know what you want to do for the rest of your life?

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...