CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Discussion »
  • Extensions (Moderators: mathieu, totten, kasiawaka) »
  • Want to auto populate city and state from an entered U.S. zip code, WordPress
Pages: [1]

Author Topic: Want to auto populate city and state from an entered U.S. zip code, WordPress  (Read 1269 times)

LakeGirlMT

  • I’m new here
  • *
  • Posts: 3
  • Karma: 0
  • CiviCRM version: 4.7
  • CMS version: 4.4.2 wordpress
  • MySQL version: MariaDB equivalent to MySQL 5.7
  • PHP version: not sure
Want to auto populate city and state from an entered U.S. zip code, WordPress
March 14, 2016, 08:14:18 am
I am a complete newbie to CiviCRM and hoping to use this platform with WordPress to replace an antiquated CRM (even has comments for displaying properly on netscape). One of the desired features is to auto populate the city and state when a user enters a U.S. zip code.

I see something similar here. https://civicrm.org/extensions/civicrm-region-lookup. However, it doesn't look like it is being maintained for recent versions of CiviCRM. Is this a red flag? Also noted that this is for Drupal and I would need a WordPress version.

I did manage to find Administer > System Settings > Extensions but I don't see anything there similar to what I need.

I also see that USPS has Web Tools API with this functionality but wouldn't know how to implement that for CiviCRM within Wordpress. https://www.usps.com/business/web-tools-apis/address-information-api.htm#_Toc410982991

All ideas, suggestions and help would be very welcome.

Thanks so much in advance!

D
« Last Edit: March 14, 2016, 09:30:30 am by LakeGirlMT »

mathieu

  • Administrator
  • Ask me questions
  • *****
  • Posts: 620
  • Karma: 36
    • Work
  • CiviCRM version: 4.7
  • CMS version: Drupal
  • MySQL version: MariaDB 10
  • PHP version: 7
Re: Want to auto populate city and state from an entered U.S. zip code, WordPress
March 14, 2016, 10:06:09 am
Hi,

I am the developer of civicrm-region-lookup. I use it on CiviCRM 4.6, and it would require a small fix for CiviCRM 4.7, but it should work otherwise.

Although it is probably not the most user-friendly solution. It was meant to be flexible and vendor-neutral (i.e. not rely on specific paid sites for the data, make it possible to manage your own mappings).

For the US, you would need to import a list of postcodes via phpmyadmin, then configure the correct mapping in the admin settings (i.e. to set the field names so that the postcode field sets the city, but you might need an additional custom Javascript hook to set the state as well, which is not ideal, but not very complicated either).

There may be simpler solutions out there, especially for the US. If you decide to use this extension, I will be happy to provide some support on this forum if you run into issues.

Mathieu
CiviCamp Montréal, 29 septembre 2017 | Co-founder / consultant / turn-key CiviCRM hosting for Quebec/Canada @ SymbioTIC.coop

LakeGirlMT

  • I’m new here
  • *
  • Posts: 3
  • Karma: 0
  • CiviCRM version: 4.7
  • CMS version: 4.4.2 wordpress
  • MySQL version: MariaDB equivalent to MySQL 5.7
  • PHP version: not sure
Re: Want to auto populate city and state from an entered U.S. zip code, WordPress
March 16, 2016, 06:42:57 am
Thank you so much for your response Mathieu! I will most likely be reaching out to you for advice as I begin this project.

petednz

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4899
  • Karma: 193
    • Fuzion
  • CiviCRM version: 3.x - 4.x
  • CMS version: Drupal 6 and 7
Re: Want to auto populate city and state from an entered U.S. zip code, WordPress
May 29, 2016, 09:55:55 pm
Does this go some way to the data that would need to be added for the ZIP > State part of the task for the USA?

http://svn.civicrm.org/civicrm/branches/v4.1/sql/zipcodes.mysql
Sign up to StackExchange and get free expert advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

pete davis : www.fuzion.co.nz : connect + campaign + communicate

petednz

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4899
  • Karma: 193
    • Fuzion
  • CiviCRM version: 3.x - 4.x
  • CMS version: Drupal 6 and 7
Re: Want to auto populate city and state from an entered U.S. zip code, WordPress
May 29, 2016, 11:11:21 pm
thought i would give this a run through

on nginx and don't know how to resolve those issues but ..

twigged that table called civicrm_regionlookup should be created

it was

tried to enter a manual row - was disallowed due to lack of log_ table

turned logging off/on to trigger creation of log_civicrm_regionlookup

entered a single row eg

Code: [Select]
postcode district borough city county state country state_riding country_riding
210 Portsmouth NH 1228

testing using a contribution form that uses Name and Address profile put following

city: .billing_name_address-section input#billing_city-5
State/province: .billing_name_address-section input#billing_state_province-5
Country: .billing_name_address-section input#billing_country-5

(based on 'inspect' of 'city' and assuming the rest))

enters 210 in postcode, tab, see Portsmouth (woohoo) but not 'state = NH'

tried changing NH to 1028 in case it needed the state id - no joy

assume i didn't get the identifiers right for the dropdown state field - eg - http://d46.demo.civicrm.org/civicrm/contribute/transact?reset=1&id=1

but  - getting close ;-)

unfortunately the key objective is to have this happen on webforms too - so perhaps i should have been looking for a drupal solution too
Sign up to StackExchange and get free expert advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

pete davis : www.fuzion.co.nz : connect + campaign + communicate

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Discussion »
  • Extensions (Moderators: mathieu, totten, kasiawaka) »
  • Want to auto populate city and state from an entered U.S. zip code, WordPress

This forum was archived on 2017-11-26.