Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

How to quickly delete a big number of Countries ?


benspun

Recommended Posts

Hi,

 

I want to configure a shop which sells only to so-called "developped" countries, that is to about 50 countries in total. The countries list that came with my installation of osCommerce has over 200 countries in it.

 

How to quickly delete the countries I don't want without clicking 150 times on the unwanted country, then clicking "Delete" and then "Are you sure you want to delete this country?": Delete.

 

I know very little about MySQL. Is there any direct way to delete these entries in the database ? Or any other method ?

 

Thanks,

Link to comment
Share on other sites

Access phpMyAdmin from your web hosting control panel, go to Countries, and then click on the Browse tab. This will bring up the first page of countries (usually about 30 displayed at a time). If your version of phpMyAdmin has the function then tick 'Check All' at the bottom of the list and then select the rubbish bin symbol or the 'drop' box entry. If it doesn't have this feature then you will manually have to tick all of the boxes. Then click 'Go'.

 

Be sure not to delete any countries you wish to keep.

 

Vger

Link to comment
Share on other sites

I used this query to delete unwanted countries. Note: the countries listed here are the ones I wanted to KEEP, not the ones to delete.

 

delete from countries where countries_iso_code_2 not in
('AS','AT','AU','BE','CA','CN','DK','FI','FR','DE','GR','GU','HK','IE','IL
','IT','JP','MP','MH','FM','NL','NZ','NO','PW','PT','PR','SG','ES','SE','CH','GB
','US','UM','VI')

 

You could just change yours to reflect the ISO code for the ones you want on your list.

 

HTH,

 

Terry

Terry Kluytmans

 

Contribs Installed: Purchase Without Account (PWA); Big Images, Product Availability, Description in Product Listing, Graphical Infobox, Header Tags Controller, Login Box, Option Type Feature, plus many layout changes & other mods of my own, like:

 

Add order total to checkout_shipment

Add order total to checkout_payment

Add radio buttons at checkout_shipping (for backorder options, etc.)

Duplicate Table Rate Shipping Module

Better Product Review Flow

 

* If at first you don't succeed, find out if there's a prize for the loser. *

Link to comment
Share on other sites

Access phpMyAdmin from your web hosting control panel, go to Countries, and then click on the Browse tab.? This will bring up the first page of countries (usually about 30 displayed at a time).? If your version of phpMyAdmin has the function then tick 'Check All' at the bottom of the list and then select the rubbish bin symbol or the 'drop' box entry.? If it doesn't have this feature then you will manually have to tick all of the boxes.? Then click 'Go'.

 

Be sure not to delete any countries you wish to keep.

 

Vger

 

OOOPS! I was deleting countries I didn't want and I deleted CANADA!!! The only country I want. I restored my catalog/admin/countries.php file but the code didn't come back. Can someone tell me what it should be please. Is it CA CDN or CA CAD???

 

:'(

Link to comment
Share on other sites

OOOPS! I was deleting countries I didn't want and I deleted CANADA!!! The only country I want.  I restored my catalog/admin/countries.php file but the code didn't come back.  Can someone tell me what it should be please.  Is it CA CDN or CA CAD???

 

:'(

 

It's CA CAN

 

HTH,

 

Terry

Terry Kluytmans

 

Contribs Installed: Purchase Without Account (PWA); Big Images, Product Availability, Description in Product Listing, Graphical Infobox, Header Tags Controller, Login Box, Option Type Feature, plus many layout changes & other mods of my own, like:

 

Add order total to checkout_shipment

Add order total to checkout_payment

Add radio buttons at checkout_shipping (for backorder options, etc.)

Duplicate Table Rate Shipping Module

Better Product Review Flow

 

* If at first you don't succeed, find out if there's a prize for the loser. *

Link to comment
Share on other sites

I used this query to delete unwanted countries. Note: the countries listed here are the ones I wanted to KEEP, not the ones to delete.

 

delete from countries where countries_iso_code_2 not in
('AS','AT','AU','BE','CA','CN','DK','FI','FR','DE','GR','GU','HK','IE','IL
','IT','JP','MP','MH','FM','NL','NZ','NO','PW','PT','PR','SG','ES','SE','CH','GB
','US','UM','VI')

 

You could just change yours to reflect the ISO code for the ones you want on your list.

 

HTH,

 

Terry

 

 

Please excuse my relatively low level of knowledge on MySQL, but where (or with what tool/software) do you give this query ?

 

Thanks,

 

Ben

Link to comment
Share on other sites

Please excuse my relatively low level of knowledge on MySQL, but where (or with what tool/software) do you give this query ?

 

Thanks,

 

Ben

 

If you have phpMyAdmin, open it. I believe you should see a query button as soon as you select your database -- or when you browse through a table in your database, can't remember for sure which.

 

(I was a little nervous the first few times I did a SQL query, but have gotten a bit more used to it now.)

 

HTH,

 

Terry

Terry Kluytmans

 

Contribs Installed: Purchase Without Account (PWA); Big Images, Product Availability, Description in Product Listing, Graphical Infobox, Header Tags Controller, Login Box, Option Type Feature, plus many layout changes & other mods of my own, like:

 

Add order total to checkout_shipment

Add order total to checkout_payment

Add radio buttons at checkout_shipping (for backorder options, etc.)

Duplicate Table Rate Shipping Module

Better Product Review Flow

 

* If at first you don't succeed, find out if there's a prize for the loser. *

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...