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.
i think it was this i used
http://www.opencart.com/index.php?route ... order=DESC
Matthew
<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>
This link will help you: http://www.technobezz.com/open-cart-cou ... t-country/
Hope it will turn the tide
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.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?
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/
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.
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.
I am in India, I have only India country and state, can you please guide me i remove other country ?
Thank You.
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!dswtpl wrote:If you delete country so it will not longer use to the site
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)
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.
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 = ocerik1432 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.
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.
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.
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>";
}
!!! Dont forget to remove this file afterwards,
i am not responsible for mistakes.
Best to backup ur database before
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
testje wrote: ↑Sat Apr 15, 2017 11:06 pmI made a little simple script te remove countries
create a file calles test.php and put the following code in there
And if you now go to yoursite.com/test.php you have a list with countries wich you can easily delete.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>"; }
!!! Dont forget to remove this file afterwards,
i am not responsible for mistakes.
Best to backup ur database before
Great Job mate
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.
Users browsing this forum: No registered users and 101 guests