0

Please suggest a way to add an extra Region /State in checkout which is not there in Opencart default .

Nitin
  • 13
  • 1
  • 4

2 Answers2

2

You can add region for any country from admin panel also.

settings->localisation->zone

Tanmoy
  • 1,035
  • 6
  • 19
1

The region/states are in the oc_zone table. You can add extra entries into this table but make sure you get the right country code and put that into the record too.

The country codes are in the oc_country table.

So, for example, if you wanted to add a new Region called "The People's Republic of Cleckheaton" to the United Kingdom, first look up the country code for the United Kingdom in oc_country. The code is 222.

Then you can add the new zone to oc_zone with something like the following:

INSERT INTO `oc_zone` (`zone_id`, `country_id`, `name`, `code`, `status`) VALUES (NULL, '222', 'The Peoples Republic of Cleckheaton', 'PRC', '1');

Finally there's another slight issue. Opencart actually caches all the country and zone data so if you add a new field like this it probably won't show up because the old data will be cached.

You should probably be able to fix this by clearing your browser's cache but failing that update the following line in \catalog\model\localisation\zone.php Warning: This is in opencart 1.5.6 but should be similar in 2.0

$zone_data = $this->cache->get('zone.' . (int)$country_id);

to

zone_data = false;

Once you've confirmed it's working ok update that line back to it's original content.

jx12345
  • 1,650
  • 2
  • 22
  • 40