Crafty_Clicks_International_Address_Validation - Version 0.2.3

Version Notes

Release History
v0.2.3
* Updated maps settings for a cleaner interface
* Fix: v0.2.2 had a special no results condition under which the correction page didn't appear.
v0.2.2
* Fixed issue with order of house number and street
* Fixed problem when no results found
* Fixed issue with quotes in address
v0.2.1
* added compatibility for new google authentication way for the geocoding service
* fixed an issue related to multiple address lines
v0.2.0
* Major Structural Rework
v0.1.4
* Fix: better handling of region dropdowns
v0.1.3
* Fix: added check for google CDN state.
v0.1.2
* Stable release
v0.1.1
* Fix: some gmaps suggestions were considered premise level when they were not.
v0.1.0
* Initial Release

Download this release

Release Info

Developer Crafty Clicks
Extension Crafty_Clicks_International_Address_Validation
Version 0.2.3
Comparing to
See all releases


Code changes from version 0.2.2 to 0.2.3

app/code/community/Craftyclicks/Googleaddressvalidate/etc/config.xml CHANGED
@@ -12,7 +12,7 @@
12
  <config>
13
  <modules>
14
  <Craftyclicks_Googleaddressvalidate>
15
- <version>0.2.2</version>
16
  </Craftyclicks_Googleaddressvalidate>
17
  </modules>
18
 
12
  <config>
13
  <modules>
14
  <Craftyclicks_Googleaddressvalidate>
15
+ <version>0.2.3</version>
16
  </Craftyclicks_Googleaddressvalidate>
17
  </modules>
18
 
app/design/frontend/base/default/template/craftyclicks/googleaddressvalidate/post_checkout.phtml CHANGED
@@ -80,7 +80,6 @@ if($confG['active'] && !($shippingAddress->country_id == 'GB' && 1 == $confC['ac
80
  <!-- new url and customisable google maps api key -->
81
  <script src="//maps.googleapis.com/maps/api/js?key=<?php echo $confG['google_maps_api_key']?>"></script>
82
  <script type="text/javascript">
83
-
84
  <?php
85
  if($confG['gmaps']):
86
  ?>
@@ -89,20 +88,23 @@ if($confG['active'] && !($shippingAddress->country_id == 'GB' && 1 == $confC['ac
89
  var map_options = {
90
  center: new google.maps.LatLng(x,y),
91
  zoom: 16,
92
- mapTypeId: google.maps.MapTypeId.ROADMAP
 
 
93
  }
94
  var map = new google.maps.Map(map_canvas, map_options);
 
 
 
 
95
  }
96
  <?php
97
  endif;
98
  // de-\n-ifyer code snippet - Greg (Crafty Clicks)
99
  $shippingAddress->_data = str_replace("\n"," ",$shippingAddress->_data);
100
- $shippingAddress->_data = str_replace("'","",$shippingAddress->_data);
101
- $shippingAddress->_data = str_replace('"',"",$shippingAddress->_data);
102
- echo "var shipping = '" . json_encode ($shippingAddress->_data) . "'.evalJSON();";
103
 
104
  ?>
105
-
106
  function check_match(infoHolder,original){
107
  var flag = true;
108
 
@@ -112,7 +114,6 @@ if($confG['active'] && !($shippingAddress->country_id == 'GB' && 1 == $confC['ac
112
  flag = false;
113
  if(typeof infoHolder.address !== "undefined" && original_address.toLowerCase().indexOf(infoHolder.combined_street.toLowerCase()) == -1)
114
  flag = false;
115
-
116
  if(typeof infoHolder.country !== "undefined" && original.country.toLowerCase() != infoHolder.country.short_name.toLowerCase())
117
  flag = false;
118
 
@@ -131,10 +132,8 @@ if($confG['active'] && !($shippingAddress->country_id == 'GB' && 1 == $confC['ac
131
  if(typeof google !== "undefined"){
132
 
133
  var html = '<div class="buttons-set" id="correct_box"><img style="margin: auto;" src="<?php echo $loading_image; ?>"/></div>';
134
-
135
  $$('.buttons-set')[0].insert({before :html});
136
 
137
-
138
  var address = shipping.street+" "+shipping.postcode+" "+shipping.city+" "+shipping.country_id;
139
  var geocoder = new google.maps.Geocoder();
140
 
@@ -144,7 +143,6 @@ if($confG['active'] && !($shippingAddress->country_id == 'GB' && 1 == $confC['ac
144
  original.postalcode = shipping.postcode.toLowerCase();
145
  original.city = shipping.city.toLowerCase();
146
 
147
-
148
  var suggestions = new Array();
149
  var data = new Array();
150
 
@@ -187,25 +185,23 @@ if($confG['active'] && !($shippingAddress->country_id == 'GB' && 1 == $confC['ac
187
  } else {
188
  doCheck = true;
189
  }
190
-
191
  } else {
192
  doCheck = true;
193
  //not premise level
194
  }
195
-
196
  }
197
  else {
198
  //super bogus data
199
  doCheck = true;
200
  }
201
 
202
- if(doCheck && results[0]!==undefined){
203
 
204
  $('correct_box').update($('hidden-correction').innerHTML);
205
  $('hidden-correction').remove();
206
-
207
- initialize_gmaps(results[0].geometry.location.lat(), results[0].geometry.location.lng());
208
-
209
  $('address').value = shipping.street;
210
  $('town').value = shipping.city;
211
  $('postcode').value = shipping.postcode;
@@ -216,9 +212,9 @@ if($confG['active'] && !($shippingAddress->country_id == 'GB' && 1 == $confC['ac
216
  var options = $$('select#region_id option');
217
  var len = options.length;
218
  for (var i = 0; i < len; i++) {
219
- if(options[i].value == shipping.region_id){
220
- options[i].selected = true;
221
- }
222
  }
223
  //$('region_id')[shipping.region_id].selected = true;
224
  } else {
@@ -297,10 +293,10 @@ if($confG['active'] && !($shippingAddress->country_id == 'GB' && 1 == $confC['ac
297
  if(elem.length == 1){
298
  //gather all data and copy it to the form.
299
  var li = elem[0].up('li');
300
- $('address').value = li.readAttribute('data-street');
301
- $('town').value = li.readAttribute('data-town');
302
- $('postcode').value = li.readAttribute('data-postcode');
303
- $('region').value = li.readAttribute('data-region');
304
  } else {
305
  //if it's manual & region dropdown is provided, copy the selected region value to the region form element.
306
  if($('region_id').childElements('option').length){
@@ -312,10 +308,10 @@ if($confG['active'] && !($shippingAddress->country_id == 'GB' && 1 == $confC['ac
312
  {
313
  method:'get',
314
  parameters: {
315
- street: $('address').getValue(),
316
- city: $('town').getValue(),
317
- postcode: $('postcode').getValue(),
318
- region: $('region').getValue()
319
  },
320
  onSuccess: function(transport){
321
  $('correct_box').update('<?php echo addslashes($confG['finish_text']); ?>');
80
  <!-- new url and customisable google maps api key -->
81
  <script src="//maps.googleapis.com/maps/api/js?key=<?php echo $confG['google_maps_api_key']?>"></script>
82
  <script type="text/javascript">
 
83
  <?php
84
  if($confG['gmaps']):
85
  ?>
88
  var map_options = {
89
  center: new google.maps.LatLng(x,y),
90
  zoom: 16,
91
+ mapTypeId: google.maps.MapTypeId.ROADMAP,
92
+ disableDefaultUI: true,
93
+ draggable: false
94
  }
95
  var map = new google.maps.Map(map_canvas, map_options);
96
+ var marker = new google.maps.Marker({
97
+ position: new google.maps.LatLng(x,y),
98
+ map: map
99
+ })
100
  }
101
  <?php
102
  endif;
103
  // de-\n-ifyer code snippet - Greg (Crafty Clicks)
104
  $shippingAddress->_data = str_replace("\n"," ",$shippingAddress->_data);
105
+ echo "var shipping = " . json_encode ($shippingAddress->_data) . ";";
 
 
106
 
107
  ?>
 
108
  function check_match(infoHolder,original){
109
  var flag = true;
110
 
114
  flag = false;
115
  if(typeof infoHolder.address !== "undefined" && original_address.toLowerCase().indexOf(infoHolder.combined_street.toLowerCase()) == -1)
116
  flag = false;
 
117
  if(typeof infoHolder.country !== "undefined" && original.country.toLowerCase() != infoHolder.country.short_name.toLowerCase())
118
  flag = false;
119
 
132
  if(typeof google !== "undefined"){
133
 
134
  var html = '<div class="buttons-set" id="correct_box"><img style="margin: auto;" src="<?php echo $loading_image; ?>"/></div>';
 
135
  $$('.buttons-set')[0].insert({before :html});
136
 
 
137
  var address = shipping.street+" "+shipping.postcode+" "+shipping.city+" "+shipping.country_id;
138
  var geocoder = new google.maps.Geocoder();
139
 
143
  original.postalcode = shipping.postcode.toLowerCase();
144
  original.city = shipping.city.toLowerCase();
145
 
 
146
  var suggestions = new Array();
147
  var data = new Array();
148
 
185
  } else {
186
  doCheck = true;
187
  }
 
188
  } else {
189
  doCheck = true;
190
  //not premise level
191
  }
 
192
  }
193
  else {
194
  //super bogus data
195
  doCheck = true;
196
  }
197
 
198
+ if(doCheck){
199
 
200
  $('correct_box').update($('hidden-correction').innerHTML);
201
  $('hidden-correction').remove();
202
+ if(results.length){
203
+ initialize_gmaps(results[0].geometry.location.lat(), results[0].geometry.location.lng());
204
+ }
205
  $('address').value = shipping.street;
206
  $('town').value = shipping.city;
207
  $('postcode').value = shipping.postcode;
212
  var options = $$('select#region_id option');
213
  var len = options.length;
214
  for (var i = 0; i < len; i++) {
215
+ if(options[i].value == shipping.region_id){
216
+ options[i].selected = true;
217
+ }
218
  }
219
  //$('region_id')[shipping.region_id].selected = true;
220
  } else {
293
  if(elem.length == 1){
294
  //gather all data and copy it to the form.
295
  var li = elem[0].up('li');
296
+ $('address').value = li.readAttribute('data-street');
297
+ $('town').value = li.readAttribute('data-town');
298
+ $('postcode').value = li.readAttribute('data-postcode');
299
+ $('region').value = li.readAttribute('data-region');
300
  } else {
301
  //if it's manual & region dropdown is provided, copy the selected region value to the region form element.
302
  if($('region_id').childElements('option').length){
308
  {
309
  method:'get',
310
  parameters: {
311
+ street: $('address').getValue(),
312
+ city: $('town').getValue(),
313
+ postcode: $('postcode').getValue(),
314
+ region: $('region').getValue()
315
  },
316
  onSuccess: function(transport){
317
  $('correct_box').update('<?php echo addslashes($confG['finish_text']); ?>');
app/etc/modules/CraftyClicksValidate.xml CHANGED
@@ -4,7 +4,6 @@
4
  <CraftyClicksValidate>
5
  <active>false</active>
6
  <codePool>local</codePool>
7
- <version>0.2.2</version>
8
  </CraftyClicksValidate>
9
  </modules>
10
  </config>
4
  <CraftyClicksValidate>
5
  <active>false</active>
6
  <codePool>local</codePool>
 
7
  </CraftyClicksValidate>
8
  </modules>
9
  </config>
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Crafty_Clicks_International_Address_Validation</name>
4
- <version>0.2.2</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
  <channel>community</channel>
@@ -11,6 +11,9 @@
11
  &#xD;
12
  Upon completing a checkout, the shipping address gets validated, to ensure the existence of the location. In case the address cannot be confirmed, suggestions to fix the address will be shown, with the option to manually check and fix the address.</description>
13
  <notes>Release History&#xD;
 
 
 
14
  v0.2.2&#xD;
15
  * Fixed issue with order of house number and street&#xD;
16
  * Fixed problem when no results found&#xD;
@@ -31,9 +34,9 @@ v0.1.1&#xD;
31
  v0.1.0&#xD;
32
  * Initial Release</notes>
33
  <authors><author><name>Crafty Clicks</name><user>styloa</user><email>support@craftyclicks.co.uk</email></author></authors>
34
- <date>2016-10-06</date>
35
- <time>15:48:53</time>
36
- <contents><target name="mage"><dir name="app"><dir name="etc"><dir name="modules"><file name="CraftyClicksValidate.xml" hash="2c6649e35bab8258530b5e29d21cd889"/><file name="Craftyclicks_Googleaddressvalidate.xml" hash="98941aa74d74ad1b38e7e115e8fa2054"/></dir></dir><dir name="code"><dir name="community"><dir name="Craftyclicks"><dir name="Googleaddressvalidate"><dir><dir name="Helper"><file name="Data.php" hash="88b3d1efbb6062cca7c6e1107ef56417"/></dir><dir name="controllers"><file name="AjaxController.php" hash="d104bd4b0d88e89251aa8b58a5cbee6e"/></dir><dir name="data"><dir name="craftyclicks_googleaddressvalidate_setup"><file name="data-upgrade-0.1.6-0.2.0.php" hash="a1d598c914774d28bd4fab27961cda02"/></dir></dir><dir name="etc"><file name="config.xml" hash="118ef7182cc5c689ee39a9d97e03857a"/><file name="system.xml" hash="19f1436c911b1c59771b167eaac75049"/></dir></dir></dir></dir></dir></dir><dir name="design"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="craftyclicks_googleaddressvalidate.xml" hash="b785571ac8a14fcde43cb76dce15908f"/></dir><dir name="template"><dir name="craftyclicks"><dir name="googleaddressvalidate"><file name="post_checkout.phtml" hash="827189c5e2709a06803c133c84d0a532"/></dir></dir></dir></dir></dir></dir></dir></dir><dir name="skin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><dir name="craftyclicks"><dir name="googleaddressvalidate"><file name="validate.css" hash="353e6e8267ce0a7fccad15bc1d1418cd"/><file name="validate_old.css" hash="3a4dd9986bdf93462afb0c6a20ac838e"/></dir></dir></dir><dir name="images"><dir name="craftyclicks"><dir name="googleaddressvalidate"><file name="crafty_validate_busy.gif" hash="7660c91e294e91f80219d3c8f6512dca"/></dir></dir></dir></dir></dir></dir></dir></target></contents>
37
  <compatible/>
38
  <dependencies><required><php><min>5.3.0</min><max>7.9.0</max></php></required></dependencies>
39
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Crafty_Clicks_International_Address_Validation</name>
4
+ <version>0.2.3</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
  <channel>community</channel>
11
  &#xD;
12
  Upon completing a checkout, the shipping address gets validated, to ensure the existence of the location. In case the address cannot be confirmed, suggestions to fix the address will be shown, with the option to manually check and fix the address.</description>
13
  <notes>Release History&#xD;
14
+ v0.2.3&#xD;
15
+ * Updated maps settings for a cleaner interface&#xD;
16
+ * Fix: v0.2.2 had a special no results condition under which the correction page didn't appear.&#xD;
17
  v0.2.2&#xD;
18
  * Fixed issue with order of house number and street&#xD;
19
  * Fixed problem when no results found&#xD;
34
  v0.1.0&#xD;
35
  * Initial Release</notes>
36
  <authors><author><name>Crafty Clicks</name><user>styloa</user><email>support@craftyclicks.co.uk</email></author></authors>
37
+ <date>2016-10-11</date>
38
+ <time>08:11:29</time>
39
+ <contents><target name="mage"><dir name="app"><dir name="etc"><dir name="modules"><file name="CraftyClicksValidate.xml" hash="46eeefc26f6ae3b592c0983123f6ed36"/><file name="Craftyclicks_Googleaddressvalidate.xml" hash="98941aa74d74ad1b38e7e115e8fa2054"/></dir></dir><dir name="code"><dir name="community"><dir name="Craftyclicks"><dir name="Googleaddressvalidate"><dir><dir name="Helper"><file name="Data.php" hash="88b3d1efbb6062cca7c6e1107ef56417"/></dir><dir name="controllers"><file name="AjaxController.php" hash="d104bd4b0d88e89251aa8b58a5cbee6e"/></dir><dir name="data"><dir name="craftyclicks_googleaddressvalidate_setup"><file name="data-upgrade-0.1.6-0.2.0.php" hash="a1d598c914774d28bd4fab27961cda02"/></dir></dir><dir name="etc"><file name="config.xml" hash="ec550e123f7215738b2a45d0e04d437c"/><file name="system.xml" hash="19f1436c911b1c59771b167eaac75049"/></dir></dir></dir></dir></dir></dir><dir name="design"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="craftyclicks_googleaddressvalidate.xml" hash="b785571ac8a14fcde43cb76dce15908f"/></dir><dir name="template"><dir name="craftyclicks"><dir name="googleaddressvalidate"><file name="post_checkout.phtml" hash="f0358fcd90711350b6a86d9900a03e48"/></dir></dir></dir></dir></dir></dir></dir></dir><dir name="skin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><dir name="craftyclicks"><dir name="googleaddressvalidate"><file name="validate.css" hash="353e6e8267ce0a7fccad15bc1d1418cd"/><file name="validate_old.css" hash="3a4dd9986bdf93462afb0c6a20ac838e"/></dir></dir></dir><dir name="images"><dir name="craftyclicks"><dir name="googleaddressvalidate"><file name="crafty_validate_busy.gif" hash="7660c91e294e91f80219d3c8f6512dca"/></dir></dir></dir></dir></dir></dir></dir></target></contents>
40
  <compatible/>
41
  <dependencies><required><php><min>5.3.0</min><max>7.9.0</max></php></required></dependencies>
42
  </package>