msigley / Shopp-Advanced-Validation

Wordpress plugin to add advanced input validation to Shopp's checkout page. (http://shopplugin.net)
2 stars 1 forks source link

Address autocomplete #3

Closed dxdc closed 9 years ago

dxdc commented 9 years ago

Utilize IP validation and/or Google Maps plugin to speed up validation of address and country information. This could also include ZIP code validation to automatically fill in the state.

Sample freegeoip.net code for Shopp

jQuery.ajax( { 
  url: '//freegeoip.net/json/', 
  type: 'POST', 
  dataType: 'jsonp',
  success: function(location) {
    // example where I update content on the page.
    jQuery('#city').html(location.city);
    jQuery('#region-code').html(location.region_code);
    jQuery('#region-name').html(location.region_name);
    jQuery('#areacode').html(location.areacode);
    jQuery('#ip').html(location.ip);
    jQuery('#zipcode').html(location.zipcode);
    jQuery('#longitude').html(location.longitude);
    jQuery('#latitude').html(location.latitude);
    jQuery('#country-name').html(location.country_name);
    jQuery('#country-code').html(location.country_code);
  }
} );

Demo of autocomplete for address

https://developers.google.com/maps/documentation/javascript/examples/places-autocomplete

http://ubilabs.github.io/geocomplete/

This looks nice also: https://github.com/vskosp/vsGoogleAutocomplete#demo

dxdc commented 9 years ago

Added, see: https://github.com/msigley/Shopp-Advanced-Validation/pull/4

dxdc commented 9 years ago

Initial commit is working.

dxdc@e900d0b758fa619104228d9c978944534ae8213f