Skip to content

Commit 8d10fba

Browse files
committed
V2.0.1 update
Japanese postal codes database updated to March 2025 data.
1 parent e26a4c3 commit 8d10fba

22 files changed

Lines changed: 678 additions & 325 deletions

index.html

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<body>
88
<h1 style=" text-align: center;">Postal Code Automatic documentation</h1>
99
<p> </p>
10-
<p style="margin-left: 20px;">Postal Code Automatic v2.0.0 (or newer) is an
10+
<p style="margin-left: 20px;">Postal Code Automatic v2.0.x is an
1111
encapsulated plugin for Zen Cart v2.1 and above that automatically fills
1212
state, city and if available street address fields in a form when you
1313
enter postal/zip code. An Ajax request and JavaScript (jQuery) make this
@@ -38,7 +38,7 @@ <h3 style="margin-left: 40px;">INSTALL:</h3>
3838
<li><strong><em></em></strong>If an <b>old version</b> of this plugin, v1
3939
non encapsulated, is already <b>installed</b>, it is better to <b>uninstall
4040
it before</b> you install v2 encapsulated. The plugin installer can do
41-
it automatically. For that, you have to edit the file <code>zc_plugins/PostAuto/v2.0.0/installer/ScriptedInstaller.php</code>
41+
it automatically. For that, you have to edit the file <code>zc_plugins/PostAuto/v2.0.1/installer/ScriptedInstaller.php</code>
4242
. Just uncomment this line (33):<br>
4343
<code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <i> </i><b>$this-&gt;removeOldNonencapsulatedPostauto();</b></code>
4444
<br>
@@ -71,7 +71,7 @@ <h3 style="margin-left: 40px;">UNINSTALL:</h3>
7171
<p style="margin-left: 80px;"><em><strong>Note:</strong></em></p>
7272
<p style="margin-left: 120px;">If you want to keep postal codes tables when
7373
uninstalling, you can do it by commenting out the appropriate line
74-
(between 40 and 48) in file <code>zc_plugins/PostAuto/v2.0.0/installer/ScriptedInstaller.php</code>.</p>
74+
(between 55 and 63) in file <code>zc_plugins/PostAuto/v2.0.1/installer/ScriptedInstaller.php</code>.</p>
7575
<h3 style="margin-left: 40px;"> UPDATING ZONES ID:</h3>
7676
<p style="margin-left: 40px;">When you add zones for a country listed in
7777
this plugin after the plugin was installed, you can update zones ids in
@@ -134,18 +134,18 @@ <h3 style="margin-left: 40px;"> BUILDING A NEW COUNTRY TABLE DATA:</h3>
134134
<p style="margin-left: 40px;"> - Finally, few files need to be
135135
updated/created: </p>
136136
<ul style="margin-left: 40px;">
137-
<li>Create a new file <code>zc_plugins/PostAuto/v2.0.0/installer/sql/zone_to_post_code_{NewCountryCode}.php</code>.
137+
<li>Create a new file <code>zc_plugins/PostAuto/v2.0.1/installer/sql/install/zone_to_post_code_{NewCountryCode}.php</code>.
138138
Look at other files in same folder to reproduce the structure.</li>
139-
<li>Update file <code>zc_plugins/PostAuto/v2.0.0/catalog/includes/classes/ajax/zcAjaxPostcodeQuery.php</code>.
139+
<li>Update file <code>zc_plugins/PostAuto/v2.0.1/catalog/includes/classes/ajax/zcAjaxPostcodeQuery.php</code>.
140140
In the 'switch' loop you need to add a 'case' for the new country. You
141141
can copy an existing one and modify country code and SQL request
142142
especially if you have street data or not.</li>
143-
<li>Update file <code>zc_plugins/PostAuto/v2.0.0/installer/ScriptedInstaller.php</code>.
143+
<li>Update file <code>zc_plugins/PostAuto/v2.0.1/installer/ScriptedInstaller.php</code>.
144144
In function <code>executeUninstall()</code>, add a line like this:<br>
145145
<span style="margin-left: 80px;"><code>$this-&gt;executeInstallerSql("DROP
146146
TABLE IF EXISTS " . TABLE_ZONES_TO_POST_CODE_{NewCountryCode});</code></span></li>
147-
<li>Update files <code>zc_plugins/PostAuto/v2.0.0/admin/includes/extra_datafiles/postcode_auto__database_names.php</code>
148-
and <code>zc_plugins/PostAuto/v2.0.0/catalog/includes/extra_datafiles/postcode_auto__database_names.php</code>.
147+
<li>Update files <code>zc_plugins/PostAuto/v2.0.1/admin/includes/extra_datafiles/postcode_auto__database_names.php</code>
148+
and <code>zc_plugins/PostAuto/v2.0.1/catalog/includes/extra_datafiles/postcode_auto__database_names.php</code>.
149149
add a line like this:<br>
150150
<span style="margin-left: 80px;"><code>zen_define_default('TABLE_ZONES_TO_POST_CODE_{NewCountryCode}',
151151
DB_PREFIX . 'zones_to_post_code_{NewCountryCode}');</code></span></li>

zc_plugins/PostAuto/v2.0.0/admin/includes/extra_datafiles/postcode_auto__database_names.php renamed to zc_plugins/PostAuto/v2.0.1/admin/includes/extra_datafiles/postcode_auto__database_names.php

File renamed without changes.

zc_plugins/PostAuto/v2.0.0/catalog/includes/auto_loaders/config.post_auto.php renamed to zc_plugins/PostAuto/v2.0.1/catalog/includes/auto_loaders/config.post_auto.php

File renamed without changes.

zc_plugins/PostAuto/v2.0.0/catalog/includes/classes/ajax/zcAjaxPostcodeQuery.php renamed to zc_plugins/PostAuto/v2.0.1/catalog/includes/classes/ajax/zcAjaxPostcodeQuery.php

File renamed without changes.

zc_plugins/PostAuto/v2.0.0/catalog/includes/classes/observers/class.post_auto.php renamed to zc_plugins/PostAuto/v2.0.1/catalog/includes/classes/observers/class.post_auto.php

File renamed without changes.

zc_plugins/PostAuto/v2.0.0/catalog/includes/extra_datafiles/postcode_auto__database_names.php renamed to zc_plugins/PostAuto/v2.0.1/catalog/includes/extra_datafiles/postcode_auto__database_names.php

File renamed without changes.

zc_plugins/PostAuto/v2.0.0/catalog/includes/templates/default/css/stylesheet_jquery.powertip.min.css renamed to zc_plugins/PostAuto/v2.0.1/catalog/includes/templates/default/css/stylesheet_jquery.powertip.min.css

File renamed without changes.

zc_plugins/PostAuto/v2.0.0/catalog/includes/templates/default/jscript/jquery.powertip.min.js renamed to zc_plugins/PostAuto/v2.0.1/catalog/includes/templates/default/jscript/jquery.powertip.min.js

File renamed without changes.

zc_plugins/PostAuto/v2.0.0/catalog/includes/templates/default/jscript/jscript_postcode.php renamed to zc_plugins/PostAuto/v2.0.1/catalog/includes/templates/default/jscript/jscript_postcode.php

File renamed without changes.

zc_plugins/PostAuto/v2.0.0/installer/ScriptedInstaller.php renamed to zc_plugins/PostAuto/v2.0.1/installer/ScriptedInstaller.php

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,18 @@ protected function tableconstants()
1515
}
1616
unset($cod);
1717
}
18-
18+
1919
protected function executeInstall()
2020
{
2121
zen_set_time_limit(240);
2222

2323
global $sniffer;
2424

25-
$this->tableconstants();
26-
// Create each of the database tables for the post codes data.
25+
$this->tableconstants(); // Create each of the database tables for the post codes data.
26+
2727
foreach ($this->data_country as $v) {
28-
if ($sniffer->table_exists(constant('TABLE_ZONES_TO_POST_CODE_' . strtoupper($v)), 'zone_country_id') !== true && file_exists(DIR_FS_CATALOG . 'zc_plugins/PostAuto/v2.0.0/installer/sql/zones_to_post_code_' . $v . '.php')) {
29-
include_once 'sql\zones_to_post_code_' . $v . '.php';
28+
if ($sniffer->table_exists(constant('TABLE_ZONES_TO_POST_CODE_' . strtoupper($v)), 'zone_country_id') !== true) {
29+
@$result = include 'sql/install/zones_to_post_code_' . $v . '.php';
3030
}
3131
}
3232
unset($v);
@@ -35,6 +35,19 @@ protected function executeInstall()
3535
// $this->removeOldNonencapsulatedPostauto();
3636
}
3737

38+
// Note: This (https://github.com/zencart/zencart/pull/6498) Zen Cart PR must
39+
// be present in the base code or a PHP Fatal error is generated due to the
40+
// function signature difference.
41+
//
42+
protected function executeUpgrade($oldVersion)
43+
{
44+
$this->tableconstants();
45+
46+
include_once 'sql/upgrade/zones_to_post_code_jp_update2025-03.php';
47+
}
48+
49+
50+
3851
protected function executeUninstall()
3952
{
4053
$this->tableconstants();

0 commit comments

Comments
 (0)