Would love to be able to have field info auto generated for theming purposes. Adding a patch which supplies rudimentary US-based address support for devel generate. Would be willing to make it more universal (or more correct, if I'm not doing it right). Feedback welcome.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

wesnick’s picture

Status: Needs review » Needs work

I should have set this to "needs work" to indicate that this is an incomplete patch

Sheldon Rampton’s picture

Status: Needs work » Needs review
FileSize
19.59 KB

Here's an updated patch with some differences. Instead of generating addresses at random, it loads a table of about 300 real addresses in multiple countries and then randomly selects one each time it needs to fill an addressfield. This is more useful for testing purposes, because they are real addresses so it is possible to see how they do with geocoding, mapping, etc. The 300 addresses include full street addresses as well as others that are incomple and consist only of city and country so it gives an approximation of the kinds of responses you might get if users were filling in the addresses.

The patch worked as expected when I tested it.

Garrett Albright’s picture

Here's my approach (which I coded up before I found this issue…derp). On the site I'm building, addresses are limited to a single country, so I had my generation approach take that into account. It won't generate real geocodable/mappable addresses like Sheldon Rampton's above, but it's working for our needs.

rszrama’s picture

Wow, #2 is quite robust. I'm happy to commit that as is, but can you tell me where you got these addresses from? I'd hate to include someone's real address on the off chance someone testing their fulfillment system accidentally ships something out. ; )

Sheldon Rampton’s picture

Hi, Ryan. The addresses come from this website that I built recently for a multinational hackathon project:

http://www.sanitationhackathon.org/

The addresses are hackathon event locations that were actually entered by event organizers. They are therefore real addresses, but they are not the addresses of individual people. They include conference centers, businesses, addresses of NGOs and government agencies. I chose this list because:

  1. It provides addresses in a variety of countries and therefore provides some testing diversity.
  2. It provides addresses as they were actually entered by real people, which I think is a more realistic sampling for testing purposes than addresses pulled from some online directory. You'll notice that some of the addresses are merely the names of cities, and others have punctuation and capitalization anomalies.
  3. Because they are real addresses, they can be used to test geocoding modules that integrate with the addressfield module. Geocoding software requires real addresses to look up a valid latitude and longitude.
rszrama’s picture

Status: Needs review » Fixed

Thanks for the quick reply! Works for me. Let's put it in, and we can always remove items if someone decides it's an issue to be included. : P

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.