Version Notes
Release History
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.2 |
Comparing to | |
See all releases |
Code changes from version 0.2.0 to 0.2.2
- app/code/community/Craftyclicks/Googleaddressvalidate/data/craftyclicks_googleaddressvalidate_setup/data-upgrade-0.1.6-0.2.0.php +1 -1
- app/code/community/Craftyclicks/Googleaddressvalidate/etc/config.xml +7 -6
- app/code/community/Craftyclicks/Googleaddressvalidate/etc/system.xml +10 -0
- app/design/frontend/base/default/template/craftyclicks/googleaddressvalidate/post_checkout.phtml +26 -19
- app/etc/modules/CraftyClicksValidate.xml +1 -1
- package.xml +12 -5
app/code/community/Craftyclicks/Googleaddressvalidate/data/craftyclicks_googleaddressvalidate_setup/data-upgrade-0.1.6-0.2.0.php
CHANGED
@@ -25,4 +25,4 @@ if(isset($oldCfg['craftyclicksvalidate'])){
|
|
25 |
$configAccess->saveConfig('googleaddressvalidate/general/'.$k,$v, 'default', 0);
|
26 |
}
|
27 |
}
|
28 |
-
?>
|
25 |
$configAccess->saveConfig('googleaddressvalidate/general/'.$k,$v, 'default', 0);
|
26 |
}
|
27 |
}
|
28 |
+
?>
|
app/code/community/Craftyclicks/Googleaddressvalidate/etc/config.xml
CHANGED
@@ -12,22 +12,23 @@
|
|
12 |
<config>
|
13 |
<modules>
|
14 |
<Craftyclicks_Googleaddressvalidate>
|
15 |
-
<version>0.2.
|
16 |
</Craftyclicks_Googleaddressvalidate>
|
17 |
</modules>
|
18 |
|
19 |
-
<global>
|
20 |
<helpers>
|
21 |
<googleaddressvalidate>
|
22 |
<class>Craftyclicks_Googleaddressvalidate_Helper</class>
|
23 |
</googleaddressvalidate>
|
24 |
-
</helpers>
|
25 |
</global>
|
26 |
|
27 |
<default>
|
28 |
<googleaddressvalidate>
|
29 |
<general>
|
30 |
<active>0</active>
|
|
|
31 |
<loading_image></loading_image>
|
32 |
<title>Is your address correct?</title>
|
33 |
<description_1>We think there's an issue with your delivery address. Please review it.</description_1>
|
@@ -38,7 +39,7 @@
|
|
38 |
</general>
|
39 |
</googleaddressvalidate>
|
40 |
</default>
|
41 |
-
|
42 |
<frontend>
|
43 |
<layout>
|
44 |
<updates>
|
@@ -56,7 +57,7 @@
|
|
56 |
</args>
|
57 |
</googleaddressvalidate>
|
58 |
</routers>
|
59 |
-
</frontend>
|
60 |
|
61 |
<adminhtml>
|
62 |
<acl>
|
@@ -91,6 +92,6 @@
|
|
91 |
</setup>
|
92 |
</craftyclicks_googleaddressvalidate_setup>
|
93 |
</resources>
|
94 |
-
</global>
|
95 |
|
96 |
</config>
|
12 |
<config>
|
13 |
<modules>
|
14 |
<Craftyclicks_Googleaddressvalidate>
|
15 |
+
<version>0.2.2</version>
|
16 |
</Craftyclicks_Googleaddressvalidate>
|
17 |
</modules>
|
18 |
|
19 |
+
<global>
|
20 |
<helpers>
|
21 |
<googleaddressvalidate>
|
22 |
<class>Craftyclicks_Googleaddressvalidate_Helper</class>
|
23 |
</googleaddressvalidate>
|
24 |
+
</helpers>
|
25 |
</global>
|
26 |
|
27 |
<default>
|
28 |
<googleaddressvalidate>
|
29 |
<general>
|
30 |
<active>0</active>
|
31 |
+
<google_maps_api_key></google_maps_api_key>
|
32 |
<loading_image></loading_image>
|
33 |
<title>Is your address correct?</title>
|
34 |
<description_1>We think there's an issue with your delivery address. Please review it.</description_1>
|
39 |
</general>
|
40 |
</googleaddressvalidate>
|
41 |
</default>
|
42 |
+
|
43 |
<frontend>
|
44 |
<layout>
|
45 |
<updates>
|
57 |
</args>
|
58 |
</googleaddressvalidate>
|
59 |
</routers>
|
60 |
+
</frontend>
|
61 |
|
62 |
<adminhtml>
|
63 |
<acl>
|
92 |
</setup>
|
93 |
</craftyclicks_googleaddressvalidate_setup>
|
94 |
</resources>
|
95 |
+
</global>
|
96 |
|
97 |
</config>
|
app/code/community/Craftyclicks/Googleaddressvalidate/etc/system.xml
CHANGED
@@ -35,6 +35,16 @@
|
|
35 |
<show_in_store>1</show_in_store>
|
36 |
</active>
|
37 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
<loading_image translate="label">
|
39 |
<label>Loading Image</label>
|
40 |
<frontend_type>text</frontend_type>
|
35 |
<show_in_store>1</show_in_store>
|
36 |
</active>
|
37 |
|
38 |
+
<google_maps_api_key translate="label">
|
39 |
+
<label>Google Maps API Key</label>
|
40 |
+
<frontend_type>text</frontend_type>
|
41 |
+
<sort_order>11</sort_order>
|
42 |
+
<show_in_default>1</show_in_default>
|
43 |
+
<show_in_website>1</show_in_website>
|
44 |
+
<show_in_store>1</show_in_store>
|
45 |
+
<comment>https://developers.google.com/maps/documentation/javascript/get-api-key</comment>
|
46 |
+
</google_maps_api_key>
|
47 |
+
|
48 |
<loading_image translate="label">
|
49 |
<label>Loading Image</label>
|
50 |
<frontend_type>text</frontend_type>
|
app/design/frontend/base/default/template/craftyclicks/googleaddressvalidate/post_checkout.phtml
CHANGED
@@ -54,7 +54,7 @@ if($confG['active'] && !($shippingAddress->country_id == 'GB' && 1 == $confC['ac
|
|
54 |
<label for="region">Region:</label>
|
55 |
<div class="input-box">
|
56 |
<input type="text" class="crafty-input" id="region"/>
|
57 |
-
<select id="region_id" name="region_id" class="crafty-input">
|
58 |
<?php
|
59 |
if(!$confG['region_dropdown']){
|
60 |
$states = Mage::getModel('directory/country')->load($shippingAddress->country_id)->getRegions()->toOptionArray();
|
@@ -70,14 +70,15 @@ if($confG['active'] && !($shippingAddress->country_id == 'GB' && 1 == $confC['ac
|
|
70 |
</li>
|
71 |
</ul>
|
72 |
</div>
|
73 |
-
|
74 |
<button class="button" id="button-crafty-modify">Update</button>
|
75 |
|
76 |
<div id="crafty-maps-holder"></div>
|
77 |
-
|
78 |
</div>
|
79 |
</div>
|
80 |
-
|
|
|
81 |
<script type="text/javascript">
|
82 |
|
83 |
<?php
|
@@ -94,7 +95,10 @@ if($confG['active'] && !($shippingAddress->country_id == 'GB' && 1 == $confC['ac
|
|
94 |
}
|
95 |
<?php
|
96 |
endif;
|
97 |
-
|
|
|
|
|
|
|
98 |
echo "var shipping = '" . json_encode ($shippingAddress->_data) . "'.evalJSON();";
|
99 |
|
100 |
?>
|
@@ -108,7 +112,7 @@ if($confG['active'] && !($shippingAddress->country_id == 'GB' && 1 == $confC['ac
|
|
108 |
flag = false;
|
109 |
if(typeof infoHolder.address !== "undefined" && original_address.toLowerCase().indexOf(infoHolder.combined_street.toLowerCase()) == -1)
|
110 |
flag = false;
|
111 |
-
|
112 |
if(typeof infoHolder.country !== "undefined" && original.country.toLowerCase() != infoHolder.country.short_name.toLowerCase())
|
113 |
flag = false;
|
114 |
|
@@ -127,12 +131,11 @@ if($confG['active'] && !($shippingAddress->country_id == 'GB' && 1 == $confC['ac
|
|
127 |
if(typeof google !== "undefined"){
|
128 |
|
129 |
var html = '<div class="buttons-set" id="correct_box"><img style="margin: auto;" src="<?php echo $loading_image; ?>"/></div>';
|
130 |
-
|
131 |
$$('.buttons-set')[0].insert({before :html});
|
132 |
|
133 |
|
134 |
var address = shipping.street+" "+shipping.postcode+" "+shipping.city+" "+shipping.country_id;
|
135 |
-
|
136 |
var geocoder = new google.maps.Geocoder();
|
137 |
|
138 |
var original = new Object();
|
@@ -161,10 +164,11 @@ if($confG['active'] && !($shippingAddress->country_id == 'GB' && 1 == $confC['ac
|
|
161 |
var mapsaddress = new Object();
|
162 |
|
163 |
//figure out the correct order of housenumber / street.
|
164 |
-
if(data[0].formatted.indexOf(data[0].route) > data[0].formatted.indexOf(data[0].street_number))
|
165 |
-
mapsaddress.street = data[0].street_number.long_name.toLowerCase() + " " + data[0].route.
|
166 |
-
|
167 |
-
|
|
|
168 |
|
169 |
mapsaddress.postalcode = data[0].postal_code.long_name.toLowerCase();
|
170 |
mapsaddress.city = data[0].locality.long_name.toLowerCase();
|
@@ -195,7 +199,7 @@ if($confG['active'] && !($shippingAddress->country_id == 'GB' && 1 == $confC['ac
|
|
195 |
doCheck = true;
|
196 |
}
|
197 |
|
198 |
-
if(doCheck){
|
199 |
|
200 |
$('correct_box').update($('hidden-correction').innerHTML);
|
201 |
$('hidden-correction').remove();
|
@@ -221,11 +225,11 @@ if($confG['active'] && !($shippingAddress->country_id == 'GB' && 1 == $confC['ac
|
|
221 |
$('region_id').hide();
|
222 |
$('region').value = shipping.region;
|
223 |
}
|
224 |
-
|
225 |
data.forEach(function(element){
|
226 |
// if the data provided is premise level
|
227 |
if(typeof element.route !== "undefined" && typeof element.street_number !== "undefined"){
|
228 |
-
var address = '';
|
229 |
|
230 |
var region = '';
|
231 |
if(typeof element.administrative_area_level_1 !== "undefined"){
|
@@ -244,7 +248,7 @@ if($confG['active'] && !($shippingAddress->country_id == 'GB' && 1 == $confC['ac
|
|
244 |
|
245 |
var route = '';
|
246 |
if(typeof element.route !== "undefined"){
|
247 |
-
route = element.route.
|
248 |
}
|
249 |
|
250 |
var street_number = '';
|
@@ -253,7 +257,7 @@ if($confG['active'] && !($shippingAddress->country_id == 'GB' && 1 == $confC['ac
|
|
253 |
}
|
254 |
if(element.formatted.indexOf(route) > element.formatted.indexOf(street_number))
|
255 |
address = street_number + " " + route;
|
256 |
-
else
|
257 |
address = route + " " + street_number;
|
258 |
|
259 |
|
@@ -304,7 +308,7 @@ if($confG['active'] && !($shippingAddress->country_id == 'GB' && 1 == $confC['ac
|
|
304 |
}
|
305 |
}
|
306 |
// pass all form values to an ajax request & update.
|
307 |
-
new Ajax.Request('<?php echo Mage::getUrl('googleaddressvalidate/ajax/update');?>',
|
308 |
{
|
309 |
method:'get',
|
310 |
parameters: {
|
@@ -318,7 +322,10 @@ if($confG['active'] && !($shippingAddress->country_id == 'GB' && 1 == $confC['ac
|
|
318 |
}
|
319 |
});
|
320 |
});
|
321 |
-
|
|
|
|
|
|
|
322 |
}
|
323 |
});
|
324 |
}
|
54 |
<label for="region">Region:</label>
|
55 |
<div class="input-box">
|
56 |
<input type="text" class="crafty-input" id="region"/>
|
57 |
+
<select id="region_id" name="region_id" class="crafty-input">
|
58 |
<?php
|
59 |
if(!$confG['region_dropdown']){
|
60 |
$states = Mage::getModel('directory/country')->load($shippingAddress->country_id)->getRegions()->toOptionArray();
|
70 |
</li>
|
71 |
</ul>
|
72 |
</div>
|
73 |
+
|
74 |
<button class="button" id="button-crafty-modify">Update</button>
|
75 |
|
76 |
<div id="crafty-maps-holder"></div>
|
77 |
+
|
78 |
</div>
|
79 |
</div>
|
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
|
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 |
?>
|
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 |
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 |
|
141 |
var original = new Object();
|
164 |
var mapsaddress = new Object();
|
165 |
|
166 |
//figure out the correct order of housenumber / street.
|
167 |
+
if(data[0].formatted.indexOf(data[0].route.short_name) > data[0].formatted.indexOf(data[0].street_number.long_name)){
|
168 |
+
mapsaddress.street = data[0].street_number.long_name.toLowerCase() + " " + data[0].route.short_name.toLowerCase();
|
169 |
+
}
|
170 |
+
else
|
171 |
+
mapsaddress.street = data[0].route.short_name.toLowerCase() + " " + data[0].street_number.long_name.toLowerCase();
|
172 |
|
173 |
mapsaddress.postalcode = data[0].postal_code.long_name.toLowerCase();
|
174 |
mapsaddress.city = data[0].locality.long_name.toLowerCase();
|
199 |
doCheck = true;
|
200 |
}
|
201 |
|
202 |
+
if(doCheck && results[0]!==undefined){
|
203 |
|
204 |
$('correct_box').update($('hidden-correction').innerHTML);
|
205 |
$('hidden-correction').remove();
|
225 |
$('region_id').hide();
|
226 |
$('region').value = shipping.region;
|
227 |
}
|
228 |
+
|
229 |
data.forEach(function(element){
|
230 |
// if the data provided is premise level
|
231 |
if(typeof element.route !== "undefined" && typeof element.street_number !== "undefined"){
|
232 |
+
var address = '';
|
233 |
|
234 |
var region = '';
|
235 |
if(typeof element.administrative_area_level_1 !== "undefined"){
|
248 |
|
249 |
var route = '';
|
250 |
if(typeof element.route !== "undefined"){
|
251 |
+
route = element.route.short_name;
|
252 |
}
|
253 |
|
254 |
var street_number = '';
|
257 |
}
|
258 |
if(element.formatted.indexOf(route) > element.formatted.indexOf(street_number))
|
259 |
address = street_number + " " + route;
|
260 |
+
else
|
261 |
address = route + " " + street_number;
|
262 |
|
263 |
|
308 |
}
|
309 |
}
|
310 |
// pass all form values to an ajax request & update.
|
311 |
+
new Ajax.Request('<?php echo Mage::getUrl('googleaddressvalidate/ajax/update',array('_secure'=>true));?>',
|
312 |
{
|
313 |
method:'get',
|
314 |
parameters: {
|
322 |
}
|
323 |
});
|
324 |
});
|
325 |
+
|
326 |
+
}
|
327 |
+
else {
|
328 |
+
$('correct_box').remove();
|
329 |
}
|
330 |
});
|
331 |
}
|
app/etc/modules/CraftyClicksValidate.xml
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
<CraftyClicksValidate>
|
5 |
<active>false</active>
|
6 |
<codePool>local</codePool>
|
7 |
-
<version>0.
|
8 |
</CraftyClicksValidate>
|
9 |
</modules>
|
10 |
</config>
|
4 |
<CraftyClicksValidate>
|
5 |
<active>false</active>
|
6 |
<codePool>local</codePool>
|
7 |
+
<version>0.2.2</version>
|
8 |
</CraftyClicksValidate>
|
9 |
</modules>
|
10 |
</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.
|
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,13 @@
|
|
11 |

|
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
v0.2.0
|
15 |
* Major Structural Rework
|
16 |
v0.1.4
|
@@ -24,9 +31,9 @@ v0.1.1
|
|
24 |
v0.1.0
|
25 |
* Initial Release</notes>
|
26 |
<authors><author><name>Crafty Clicks</name><user>styloa</user><email>support@craftyclicks.co.uk</email></author></authors>
|
27 |
-
<date>
|
28 |
-
<time>
|
29 |
-
<contents><target name="mage"><dir name="app"><dir name="etc"><dir name="modules"><file name="CraftyClicksValidate.xml" hash="
|
30 |
<compatible/>
|
31 |
-
<dependencies><required><php><min>
|
32 |
</package>
|
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 |

|
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
|
14 |
+
v0.2.2
|
15 |
+
* Fixed issue with order of house number and street
|
16 |
+
* Fixed problem when no results found
|
17 |
+
* Fixed issue with quotes in address
|
18 |
+
v0.2.1
|
19 |
+
* added compatibility for new google authentication way for the geocoding service
|
20 |
+
* fixed an issue related to multiple address lines
|
21 |
v0.2.0
|
22 |
* Major Structural Rework
|
23 |
v0.1.4
|
31 |
v0.1.0
|
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>
|