Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Country list


RojanUK

Recommended Posts

Hi,

 

When I started building my site back in July last year my supplier only shipped to the UK. So, I removed the country list from the database and hard coded 'United Kingdom' as country, thus removing the pull down choice menu.

 

Recently my supplier has changed to worldwide shipping, so I really need the country list back and return the pull down choice menu back to its original state. As I removed the countries in Admin manually I'm just wondering whether there is any way of reinstalling that list without affecting my current site too much, or whether I have no choice but to start all over from scratch.

 

Any hint or tip will be greatly appreciated.

 

Thanks,

RojanUK

Link to comment
Share on other sites

Download (if you don't still have it) the osCommerce ZIP file, and take the countries list out of the install/oscommerce.sql file, like so:

 

INSERT INTO countries VALUES (1,'Afghanistan','AF','AFG','1');

INSERT INTO countries VALUES (2,'Albania','AL','ALB','1');

INSERT INTO countries VALUES (3,'Algeria','DZ','DZA','1');

 

etc.

 

and save these into a text file. Then go to your phpMyAdmin link, locate the Countries table, click the SQL link at the top of the page, and then use the SQL Query box and the Browse function to locate the new text file on your computer and run it into the database.

 

Vger

Link to comment
Share on other sites

Hi Vger. Thanks for you fast answer.

I've tried to do what you suggested, but got a duplicate key error. So I started browsing the countries table in the SQL database and to my surprise all countries were still there. This creates a whole new problem. So, the situation is as follows: the countries are still in the database, but they have been removed from admin. In admin only the UK is still visible.

 

I can find a way to remove the hard coding from the site, but I don't know how to resurect the country list in full. They are in the database, but not in admin anymore.

 

I'm open for suggestions.

 

Thanks,

RojanUK

Link to comment
Share on other sites

Correction to my previous post:

 

Even though I got the duplicate key error the countries were actually loaded again following Vger's system. When I just checked it out it sneaked over to my live site admin instead of the test site admin on which I've tested Vger's solution. Hmmm.. Anyway, despite the error all countries were loaded properly. Strange that I still got an error though. :blink:

 

So, next step will be unlocking the code in the site, but this has definately brought me a step closer to solving it. If I can put everything back the way it was I won't have to start from scratch again. That would be lovely.

 

As I have to do the same for currency I assume the same solution would apply?

 

Thanks,

RojanUK

Link to comment
Share on other sites

Scrap everything I said. I tested a contrib yesterday and that had already put the countries and the currencies back into my test database. Which is why I got the error. So I went out on a limb and tested the above in the database of my live site and it worked like a charm.

 

Just one thing remains. It's automatically set as United States as primary. How do I change the primary to the UK? I know that I have to change the country code from 239 to 222, but I can't figure out where or how...

 

Thanks,

RojanUK

Link to comment
Share on other sites

Hmmm 239 is Zimbabwe, not United States. So it has set the primary country to Zimbabwe. If anyone can help me change that to 222 - United Kingdom, I would appreciate it.

RojanUK

Link to comment
Share on other sites

Sorry guys. Bumping this one again, as I really need an answer. I have been searching the KB and even the Internet as a whole, but I can't find the answer. I bet it's a simple code to enter in the country table, but my SQL knowledge is not big enough to figure it out.

 

To remind you of the question: How can I change the primary key country, which is currently set to 239 (Zimbabwe), to 222 (UK)?

 

Thanks,

RojanUK

Link to comment
Share on other sites

I had found that one by myself - I did mention I'd searched the KB already - but this is not an answer to my question. That article explains how to move a country to the top of the pull down list.

 

I need to know how to change the primary key country in the SQL database. Which code I need to enter in phpMyAdmin to change the primary key from 239 to 222.

RojanUK

Link to comment
Share on other sites

Primary key refers to the entire countries_id column in the table, and it ensures that each entry in the column is unique, existing only once, so that there can be no confusion between two entries in the table, as far as this column is concerned. That's it. Cardinality, where you see the 239, simply lets you know how many unique entries there are in the column.

 

Jeremy

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...