Post by pablodalma » Tue Jul 03, 2012 11:28 pm

I tried this for version 1.5.3.1 but the country dropdownlist in the registration form hangs out and it is unable to fill the zone dropdownlist . do I have to do something more for it to work in version 1.5.3.1?

Newbie

Posts

Joined
Tue Jul 03, 2012 9:35 pm

Post by greensolef » Tue Jul 10, 2012 2:02 pm

If you want other countries not displayed on the dropdrown,, just simply go to System>Localisation>Countries.
and you will see list of countries there,. now click Edit on the right side of the Country name you want not to appear and select "DISABLE" from the dropdown status and SAVE..

As simple as that!
Hope it helps.

New member

Posts

Joined
Tue Jul 03, 2012 2:20 pm

Post by Webidea » Fri Jul 13, 2012 8:00 pm

MatthewB wrote:I used the delete version last year.

But now i am expanding outside the UK is there a way of installing all countries and all zones within the countries again?
I did the same mistake, did you find a way to fix this?

Newbie

Posts

Joined
Fri Jul 13, 2012 7:57 pm

Post by MatthewB » Tue Oct 16, 2012 11:40 pm

Sorry just noticed the reply for me haha

i think it was this i used

http://www.opencart.com/index.php?route ... order=DESC

Matthew


Active Member

Posts

Joined
Sat Jul 23, 2011 5:18 am
Location - Sunderland Tyne and Wear

Post by rldev » Thu Oct 18, 2012 4:05 am

These queries don't work for me in the latest version. I get country' doesn't exist error


I was wrong. I had to put a prefix on the name. Worked great. Thanks so much.

New member

Posts

Joined
Fri Jun 15, 2012 10:13 pm

Post by copper3315 » Wed Nov 13, 2013 2:38 am

I'm using version 1.5.5.1. Opencart seems to only show enabled countries in the catalog but shows all countries in the admin section. So I wrote the following vqmod which limits results to status = 1. If anyone sees a flaw in this please let me know. Thanks.

<file name="admin/model/localisation/country.php">
<operation error="skip">
<search position="replace"><![CDATA[
$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "country ORDER BY name ASC");
]]></search>
<add><![CDATA[
$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "country WHERE status = '1' ORDER BY name ASC");
]]></add>
</operation>
</file>

Newbie

Posts

Joined
Fri Nov 01, 2013 2:49 am

Post by ryan0389 » Mon Jan 26, 2015 10:40 pm

hey guys, I know this is an old post but can anyone let me know how to disable all countries EXCEPT Australia and New Zeland?

Newbie

Posts

Joined
Thu Aug 22, 2013 11:02 pm


Post by Novell » Fri Feb 20, 2015 5:50 am

I know this is a late answer, but as support on these forums is mostly none existent, and I've had some bad times as well here is my good turn.

This link will help you: http://www.technobezz.com/open-cart-cou ... t-country/

Hope it will turn the tide

Novell


Post by IP_CAM » Fri Feb 20, 2015 8:35 am

ryan0389 wrote:hey guys, I know this is an old post but can anyone let me know how to disable all countries EXCEPT Australia and New Zeland?
First, I removed/unclicked all related 'deletable ' Country / Staate / Zone Fields by Use of the built-in MySql-Buddy in my OPENSHOP - OC v.1.5.6.5_rc based Admin section.

Then, I made a backup/download of the MySql-DB. I opened the DB by use of the Notepad++ Editor and manually deleted all Countries, States, Zones, not longer required, from the DB as well.

Then, I reuploaded the modified MySql-CB by use of the OpenShop/OpenCart 'MySql-Buddy'

And it just worked well.

Mentioned it here as well:
http://forum.opencart.com/viewtopic.php ... 56#p543467

So far, I had not one problem, just having about 4'200 less Lines, never ever used anyway, laying around in the DB...

Good Luck
Ernie
bigmax.ch/shop/
Last edited by IP_CAM on Sat Feb 21, 2015 6:27 am, edited 1 time in total.

My Github OC Site: https://github.com/IP-CAM
5'200 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland

Post by dswtpl » Fri Feb 20, 2015 6:31 pm

Hello,

I suggested to disable country in place of delete. If you delete country so it will not longer use to the site. so my personal opinion to disable country. You will make status 0 of country table which you do not want to require.

Thank You. :)

New member

Posts

Joined
Thu Feb 12, 2015 10:17 pm

Post by vipuljethva » Fri Feb 20, 2015 6:39 pm

Hello Everyone,

I am in India, I have only India country and state, can you please guide me i remove other country ?

Thank You.

Newbie

Posts

Joined
Fri Feb 06, 2015 8:20 pm

Post by dswtpl » Fri Feb 20, 2015 6:43 pm

Hello Sir,

Execute following query in your your phpmyadmin

delete from country where country_id <> 99;
delete from zone where country_id <> 99;

Thank You. :)

New member

Posts

Joined
Thu Feb 12, 2015 10:17 pm

Post by IP_CAM » Sat Feb 21, 2015 1:34 am

dswtpl wrote:If you delete country so it will not longer use to the site
If one can afford to have just about 0.5 Megabyte of Data, unused ever, beeing 'scanned' in each and every DB-Access Task, one may laeve everything, as it comes. For me, it's like driving around in a Car, steady loaded with a 100 Kilo Box in the Trunk, you may don't 'feel' it, but it add's to the energy Bill, because it's a real 'figure'. 4'000 + Lines!

I really believe, that I'm trying vey hard to kill my Shop, searching for the limits of my Server as well as in the Software. But since I never (yet) run into a single Problem, in regard to the 'Line-reduced' DB, I can't see a good reason to leave never ever used Countries, Staates and Zones in my DB.

My 2 Cents, no offense!
Ernie

try to kill it:
http://bigmax.ch/shop/
I pay you a beer (or Coke) :D

My Github OC Site: https://github.com/IP-CAM
5'200 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland

Post by erik1432 » Sun Mar 20, 2016 9:04 pm

For me in version 2.1.0.2 the code has to be changed a bit to work:

UPDATE oc_country SET status = 0 WHERE country_id <> 150;
UPDATE oc_zone SET status = 0 WHERE country_id <> 150;)

I am not sure if this is for everyone the same but in my database every line has oc_ in front of it.

Newbie

Posts

Joined
Sun Mar 20, 2016 8:59 pm

Post by i2Paq » Mon Mar 21, 2016 8:19 pm

erik1432 wrote:For me in version 2.1.0.2 the code has to be changed a bit to work:

UPDATE oc_country SET status = 0 WHERE country_id <> 150;
UPDATE oc_zone SET status = 0 WHERE country_id <> 150;)

I am not sure if this is for everyone the same but in my database every line has oc_ in front of it.
Because you installed it with a table_prefix = oc

Norman in 't Veldt
Moderator OpenCart Forums

_________________ READ and Search BEFORE POSTING _________________

Our FREE search: Find your answer FAST!.

[How to] BTW + Verzend + betaal setup.


User avatar
Global Moderator

Posts

Joined
Mon Nov 09, 2009 7:00 pm
Location - Winkel - The Netherlands

Post by i2Paq » Thu May 26, 2016 1:26 am

Still works for 2.2 :D

Norman in 't Veldt
Moderator OpenCart Forums

_________________ READ and Search BEFORE POSTING _________________

Our FREE search: Find your answer FAST!.

[How to] BTW + Verzend + betaal setup.


User avatar
Global Moderator

Posts

Joined
Mon Nov 09, 2009 7:00 pm
Location - Winkel - The Netherlands

Post by testje » Sat Apr 15, 2017 11:06 pm

I made a little simple script te remove countries
create a file calles test.php and put the following code in there

Code: Select all

<?php
include('config.php');

$connecttodb = mysqli_connect(DB_HOSTNAME,DB_USERNAME,DB_PASSWORD,DB_DATABASE) or die(); $GLOBALS['db'] = $connecttodb;


function q($aSQL)
{
        
        $res = $GLOBALS['db']->query($aSQL) or die('Something went wrong');
        return $res;
		
}

//delete countries
if(isset($_GET['delete'])){
	
	
	$deleteid = round($_GET['delete']);
	
	//delete from zone table
	
	q("delete from ".DB_PREFIX."zone where country_id = '$deleteid' ");
	
	//delete from country table
	q("delete from ".DB_PREFIX."country where country_id = '$deleteid' limit 1 ");
	
	
	
}

//show countries

 

$showcontries = q("select  country_id, name
								 from ".DB_PREFIX."country  
									
									order by name ASC ");
									
    
while ($countrylist = $showcontries->fetch_assoc())
				{
					
					 $country = $countrylist["name"];
					  $country_id = $countrylist["country_id"];
					  
					echo "<a href='test.php?delete=".$country_id."'>delete</a> - $country <br>";				
					 
					
				}
And if you now go to yoursite.com/test.php you have a list with countries wich you can easily delete.

!!! Dont forget to remove this file afterwards,
i am not responsible for mistakes.

Best to backup ur database before

Newbie

Posts

Joined
Fri Aug 26, 2011 12:15 am

Post by uksitebuilder » Sun Apr 16, 2017 4:48 am

I don’t understand the point of this, when you can delete multiple countries via the admin - System - Localisation - Countries section and admin - System -
Localisation - Zones section

You should also be careful as Geo Zones may have some of the deleted countries in them which may cause problems down the line. Again these can be addressed via admin - System - Localisation - Geo Zones section

p.s. I put your code in [ code ] tags to make it readable

User avatar
Guru Member

Posts

Joined
Thu Jun 09, 2011 11:37 pm
Location - United Kindgom

Post by tuncaksoy » Mon Jan 08, 2018 5:20 am

testje wrote:
Sat Apr 15, 2017 11:06 pm
I made a little simple script te remove countries
create a file calles test.php and put the following code in there

Code: Select all

<?php
include('config.php');

$connecttodb = mysqli_connect(DB_HOSTNAME,DB_USERNAME,DB_PASSWORD,DB_DATABASE) or die(); $GLOBALS['db'] = $connecttodb;


function q($aSQL)
{
        
        $res = $GLOBALS['db']->query($aSQL) or die('Something went wrong');
        return $res;
		
}

//delete countries
if(isset($_GET['delete'])){
	
	
	$deleteid = round($_GET['delete']);
	
	//delete from zone table
	
	q("delete from ".DB_PREFIX."zone where country_id = '$deleteid' ");
	
	//delete from country table
	q("delete from ".DB_PREFIX."country where country_id = '$deleteid' limit 1 ");
	
	
	
}

//show countries

 

$showcontries = q("select  country_id, name
								 from ".DB_PREFIX."country  
									
									order by name ASC ");
									
    
while ($countrylist = $showcontries->fetch_assoc())
				{
					
					 $country = $countrylist["name"];
					  $country_id = $countrylist["country_id"];
					  
					echo "<a href='test.php?delete=".$country_id."'>delete</a> - $country <br>";				
					 
					
				}
And if you now go to yoursite.com/test.php you have a list with countries wich you can easily delete.

!!! Dont forget to remove this file afterwards,
i am not responsible for mistakes.

Best to backup ur database before

Great Job mate

New member

Posts

Joined
Sun Dec 17, 2017 11:21 pm

Post by Live_Life » Sat Jul 15, 2023 2:10 am

Ok, just updating this. Backup your Database.
MyPHPAdmin > Choose Your DataBase > SQL Tab > UPDATE `xxxx_country` SET `status`='0' WHERE 1
In the UPDATE command, you need to change xxxx whatever prefix your database uses. > Go
This changes all counties to disabled status.
You can then enable all country(s) you need in Settings>Localization>Countries like just the USA or UK or whatever.
As far as, I can tell you don't need to worry about zone settings because Zones will only work if the Country is enabled. So like you enable US Country only those Zones and States show up in drop-downs. Though, I am not sure if I have tested it all.
Last edited by Live_Life on Sat Jul 15, 2023 3:14 am, edited 1 time in total.

Newbie

Posts

Joined
Sat Apr 22, 2023 3:10 am
Who is online

Users browsing this forum: No registered users and 57 guests