Data8_DataCaptureValidation - Version 2.0.0

Version Notes

Added PredictiveAddress functionality.
Replaced individual US and GB telephone validation with International Telephone Validation.

Download this release

Release Info

Developer Data8
Extension Data8_DataCaptureValidation
Version 2.0.0
Comparing to
See all releases


Code changes from version 1.0.10 to 2.0.0

app/code/community/Data8/DataCaptureValidation/etc/system.xml CHANGED
@@ -44,6 +44,16 @@
44
  <show_in_website>1</show_in_website>
45
  <show_in_store>1</show_in_store>
46
  </Data8_license>
 
 
 
 
 
 
 
 
 
 
47
  <Data8_emailValidationLevel translate="label">
48
  <label>E-mail Validation Level:</label>
49
  <comment>Select the level to validate email addresses to. Higher validation levels give better accuracy but take longer.</comment>
@@ -56,7 +66,7 @@
56
  </Data8_emailValidationLevel>
57
  <Data8_telephoneValidation translate="label">
58
  <label>Use Telephone Validation:</label>
59
- <comment>Validate UK and North American telephone numbers.</comment>
60
  <frontend_type>select</frontend_type>
61
  <source_model>adminhtml/system_config_source_yesno</source_model>
62
  <sort_order>40</sort_order>
44
  <show_in_website>1</show_in_website>
45
  <show_in_store>1</show_in_store>
46
  </Data8_license>
47
+ <Data8_usePredictiveAddress translate="label">
48
+ <label>Use PredictiveAddress&#8482;:</label>
49
+ <comment>Use auto-complete for addresses instead of Postcode Lookup</comment>
50
+ <frontend_type>select</frontend_type>
51
+ <source_model>adminhtml/system_config_source_yesno</source_model>
52
+ <sort_order>25</sort_order>
53
+ <show_in_default>1</show_in_default>
54
+ <show_in_website>1</show_in_website>
55
+ <show_in_store>1</show_in_store>
56
+ </Data8_usePredictiveAddress>
57
  <Data8_emailValidationLevel translate="label">
58
  <label>E-mail Validation Level:</label>
59
  <comment>Select the level to validate email addresses to. Higher validation levels give better accuracy but take longer.</comment>
66
  </Data8_emailValidationLevel>
67
  <Data8_telephoneValidation translate="label">
68
  <label>Use Telephone Validation:</label>
69
+ <comment>Validate international telephone numbers.</comment>
70
  <frontend_type>select</frontend_type>
71
  <source_model>adminhtml/system_config_source_yesno</source_model>
72
  <sort_order>40</sort_order>
app/design/frontend/{default → base}/default/layout/Data8_DataCaptureValidation.xml RENAMED
File without changes
app/design/frontend/{default → base}/default/template/data8/datacapturevalidation/data8_javascript.phtml RENAMED
@@ -42,13 +42,20 @@
42
 
43
  <?php } ?>
44
 
 
 
 
 
 
 
 
 
 
 
 
 
45
  <script type='text/javascript'>
46
 
47
- var s = document.createElement('script');
48
- s.type = 'text/javascript';
49
- s.src = 'https://webservices.data-8.co.uk/javascript/loader.ashx?key=<?php echo Mage::getStoreConfig('Data8/Data8_group/Data8_key',Mage::app()->getStore()); ?>&load=AddressCapture,EmailValidation,TelephoneValidation,USTelephoneValidation';
50
- document.getElementsByTagName('head')[0].appendChild(s);
51
-
52
  <?php if (Mage::getStoreConfig('Data8/Data8_group/Data8_license',Mage::app()->getStore()) != 'None') { ?>
53
  new data8.magentoPostcodeLookupButton(
54
  [
42
 
43
  <?php } ?>
44
 
45
+ <?php if (Mage::getStoreConfig('Data8/Data8_group/Data8_usePredictiveAddress',Mage::app()->getStore())) { ?>
46
+ <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.10.4/jquery-ui.min.js"></script>
47
+ <script type="text/javascript" src="https://webservices.data-8.co.uk/javascript/loader.ashx?key=<?php echo Mage::getStoreConfig('Data8/Data8_group/Data8_key',Mage::app()->getStore()); ?>&load=AddressCapture,EmailValidation,TelephoneValidation,USTelephoneValidation,PredictiveAddress,InternationalTelephoneValidation,CountryDetection"></script>
48
+ <script type="text/javascript" src="https://webservices.data-8.co.uk/javascript/predictiveaddress.js"></script>
49
+ <link type="text/css" rel="stylesheet" href="https://webservices.data-8.co.uk/content/predictiveaddress.css"></link>
50
+ <link type="text/css" rel="stylesheet" href="https://webservices.data-8.co.uk/content/jquery-ui_predictive-address.css"></link>
51
+ <script type="text/javascript">
52
+ data8.usePredictiveAddress = true;
53
+ </script>
54
+ <div class="PredictiveAddressUIContainer"></div>
55
+ <?php } ?>
56
+
57
  <script type='text/javascript'>
58
 
 
 
 
 
 
59
  <?php if (Mage::getStoreConfig('Data8/Data8_group/Data8_license',Mage::app()->getStore()) != 'None') { ?>
60
  new data8.magentoPostcodeLookupButton(
61
  [
js/Data8/magentoaddress.js CHANGED
@@ -56,6 +56,37 @@ data8.magentoPostcodeLookupButton.prototype.show = function () {
56
  if (!this.valid)
57
  return;
58
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
59
  data8.postcodeLookupButton.prototype.show.call(this);
60
 
61
  for (var i = 0; i < this.fields.length; i++) {
56
  if (!this.valid)
57
  return;
58
 
59
+ if (data8.usePredictiveAddress) {
60
+ var fieldsWithoutOrg = [];
61
+ var line1Element = null;
62
+
63
+ for (var i = 0; i < this.fields.length; i++) {
64
+ if (this.fields[i].field == 'organisation') {
65
+ d8jQuery(document.getElementById(this.fields[i].element)).predictiveaddressui({
66
+ fields: this.fields,
67
+ defaultCountry: 'GB',
68
+ appendTo: '.PredictiveAddressUIContainer'
69
+ });
70
+ }
71
+ else {
72
+ fieldsWithoutOrg.push(this.fields[i]);
73
+
74
+ if (this.fields[i].field == 'line1') {
75
+ line1Element = this.fields[i].element;
76
+ }
77
+ }
78
+ }
79
+
80
+ d8jQuery(document.getElementById(line1Element)).predictiveaddressui({
81
+ fields: fieldsWithoutOrg,
82
+ separateOrganisation: true,
83
+ defaultCountry: 'GB',
84
+ appendTo: '.PredictiveAddressUIContainer'
85
+ });
86
+
87
+ return;
88
+ }
89
+
90
  data8.postcodeLookupButton.prototype.show.call(this);
91
 
92
  for (var i = 0; i < this.fields.length; i++) {
js/Data8/validation.js CHANGED
@@ -35,22 +35,13 @@ data8.telephoneValidator = {
35
  var country = countryElement.value;
36
  e.target.data8_telephone_validation_result = null;
37
 
38
- if (value && country == 'GB') {
39
- var proxy = new data8.telephonevalidation();
40
- proxy.isvalidsimple(value, function (result) {
41
  if (!result.Status.Success)
42
  e.target.data8_telephone_validation_result = true;
43
  else
44
- e.target.data8_telephone_validation_result = result.Result;
45
- });
46
- }
47
- else if (value && (country == 'US' || country == 'CA')) {
48
- var proxy = new data8.ustelephonevalidation();
49
- proxy.isvalidsimple(value, function (result) {
50
- if (!result.Status.Success)
51
- e.target.data8_telephone_validation_result = true;
52
- else
53
- e.target.data8_telephone_validation_result = result.Result;
54
  });
55
  }
56
  else {
35
  var country = countryElement.value;
36
  e.target.data8_telephone_validation_result = null;
37
 
38
+ if (value) {
39
+ var proxy = new data8.internationaltelephonevalidation();
40
+ proxy.isvalidsimple(value, country, function (result) {
41
  if (!result.Status.Success)
42
  e.target.data8_telephone_validation_result = true;
43
  else
44
+ e.target.data8_telephone_validation_result = result.Result.ValidationResult != 'Invalid';
 
 
 
 
 
 
 
 
 
45
  });
46
  }
47
  else {
package.xml CHANGED
@@ -1,20 +1,21 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Data8_DataCaptureValidation</name>
4
- <version>1.0.10</version>
5
  <stability>stable</stability>
6
  <license>Open Software License (OSL)</license>
7
  <channel>community</channel>
8
  <extends/>
9
- <summary>Adds postcode lookup functionality for UK addresses to all address entry screens, telephone validation for UK and US telephone numbers and international email address validation.</summary>
10
- <description>* Adds postcode lookup functionality to all address entry screens, speeding up the checkout process and improving the deliverability of parcels. Covers all UK addresses and degrades gracefully when a different country is selected.&amp;#xD;&#xD;
11
- * Adds extensive telephone number validation for all UK and North American telephone numbers and degrades gracefully when a different country is selected.&amp;#xD;&#xD;
12
  * Adds extensive international email address validation.</description>
13
- <notes>Fixed error on customer address form.</notes>
 
14
  <authors><author><name>Data8</name><user>data8_technical</user><email>technical@data-8.co.uk</email></author></authors>
15
- <date>2014-05-08</date>
16
- <time>10:43:01</time>
17
- <contents><target name="magecommunity"><dir name="Data8"><dir name="DataCaptureValidation"><dir name="Block"><file name="Javascript.php" hash="16f9e4084dd2f20ca6588a39edcc1f0c"/></dir><file name="EmailValidationTypeList.php" hash="89910b62ec4efe9c4eada99b76d8b2cd"/><dir name="Helper"><file name="Data.php" hash="e8c6af1f98bf0f9640134b24dc642122"/></dir><file name="LicenseTypeList.php" hash="ddd66dd3149d083ecd69555bd4ba1a52"/><dir name="controllers"><file name="IndexController.php" hash="8d82912789ff1b1494aa56345ff5d7d9"/></dir><dir name="etc"><file name="config.xml" hash="1f1ce2961df39faeac18070051f01893"/><file name="system.xml" hash="c1a609fa83e13d2c1ccab80d3890f6a9"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="Data8_DataCaptureValidation.xml" hash="506c38f100fa1cf2b8eda1f72b694810"/></dir><dir name="template"><dir name="data8"><dir name="datacapturevalidation"><file name="data8_javascript.phtml" hash="00ac46ea0ca8a082052d5dfe72aec3f5"/></dir></dir></dir></dir></dir></dir></target><target name="mageweb"><dir name="js"><dir name="Data8"><file name="address.js" hash="90f64822d1a012b4d102035355c0203c"/><file name="jquery-1.7.1.min.js" hash="2c57990a020cc3a35c4a603413d67a28"/><file name="magentoaddress.js" hash="d7f12f57dded224ccd9447010e8b8fbf"/><file name="validation.js" hash="473d41224831d7448ebcccd850b4c123"/></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Data8_DataCaptureValidation.xml" hash="8e6a2d12c438c6fed0d66e4fe8978b12"/></dir></target><target name="magelocale"><dir name="en_US"><file name="Data8_DataCaptureValidation.csv" hash="845e7bce7a102df9aefb67abace15a1c"/></dir></target></contents>
18
  <compatible/>
19
  <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
20
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Data8_DataCaptureValidation</name>
4
+ <version>2.0.0</version>
5
  <stability>stable</stability>
6
  <license>Open Software License (OSL)</license>
7
  <channel>community</channel>
8
  <extends/>
9
+ <summary>Adds international address capture functionality to all address entry screens, international telephone number and email address validation.</summary>
10
+ <description>* Adds auto-complete functionality for international addresses, backed by authoritative data sources.&#xD;
11
+ * Adds extensive telephone number validation for international telephone numbers.&#xD;
12
  * Adds extensive international email address validation.</description>
13
+ <notes>Added PredictiveAddress functionality.&#xD;
14
+ Replaced individual US and GB telephone validation with International Telephone Validation.</notes>
15
  <authors><author><name>Data8</name><user>data8_technical</user><email>technical@data-8.co.uk</email></author></authors>
16
+ <date>2015-09-28</date>
17
+ <time>13:33:21</time>
18
+ <contents><target name="magecommunity"><dir name="Data8"><dir name="DataCaptureValidation"><dir name="Block"><file name="Javascript.php" hash="16f9e4084dd2f20ca6588a39edcc1f0c"/></dir><file name="EmailValidationTypeList.php" hash="89910b62ec4efe9c4eada99b76d8b2cd"/><dir name="Helper"><file name="Data.php" hash="e8c6af1f98bf0f9640134b24dc642122"/></dir><file name="LicenseTypeList.php" hash="ddd66dd3149d083ecd69555bd4ba1a52"/><dir name="controllers"><file name="IndexController.php" hash="8d82912789ff1b1494aa56345ff5d7d9"/></dir><dir name="etc"><file name="config.xml" hash="1f1ce2961df39faeac18070051f01893"/><file name="system.xml" hash="d15bd0ee9bae9e0c76f9c492794358a6"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="Data8_DataCaptureValidation.xml" hash="506c38f100fa1cf2b8eda1f72b694810"/></dir><dir name="template"><dir name="data8"><dir name="datacapturevalidation"><file name="data8_javascript.phtml" hash="4ff8d1a4eca49b464c8fc7bbc2d46d5c"/></dir></dir></dir></dir></dir></dir></target><target name="mageweb"><dir name="js"><dir name="Data8"><file name="address.js" hash="90f64822d1a012b4d102035355c0203c"/><file name="jquery-1.7.1.min.js" hash="2c57990a020cc3a35c4a603413d67a28"/><file name="magentoaddress.js" hash="5c2504fca5ee19ec72ac1bda84429a9a"/><file name="validation.js" hash="1441425048756b0ee30c1adce8a82ca0"/></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Data8_DataCaptureValidation.xml" hash="8e6a2d12c438c6fed0d66e4fe8978b12"/></dir></target><target name="magelocale"><dir name="en_US"><file name="Data8_DataCaptureValidation.csv" hash="845e7bce7a102df9aefb67abace15a1c"/></dir></target></contents>
19
  <compatible/>
20
  <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
21
  </package>