• the usps allows postal codes that start with 0
    +
    excel likes to strip leading 0’s from cells that are entirely numeric
    +
    unknowingly import csv via simplemaps
    =
    zip code without leading 0

    now try to edit location to fix it! not possible. why? because in locations.php, the test is:

    if ( $location_zip != $new_zip ) update_post_meta( $post, ‘location_zip’, $new_zip );

    which php helpfully views as a numeric comparision

    http://wordpress.org/extend/plugins/simplemap/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Why not try exporting your database back to Excel, use the special formatting for zipcodes (which re-inserts the leading 0), re-converting back to csv, delete the simplemaps database and then re-import the data to reconstitute the simplemaps database?

    Then the comparison above would be moot.

    Thread Starter mrose17

    (@mrose17)

    that would certain solve the problem for me this time. i don’t think it’s particularly helpful for the next N people who have the same thing happen to them…

    i addressed the issue by modifying the code. that may not be ideal, but now i don’t have to worry about remembering to tinker with the excel files that are sent to me for inclusion in the site…

    would you mind posting your fix? I have this same problem. Is it as easy as removing that one line?

    Thread Starter mrose17

    (@mrose17)

    i hope this helps. you don’t remove a line, but you change it subtly:

    in classes/locations.php:

    – if ( $location_zip != $new_zip ) update_post_meta( $post, ‘location_zip’, $new_zip );
    + if ( “$location_zip” !== “$new_zip” ) update_post_meta( $post, ‘location_zip’, $new_zip );

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Plugin: SimpleMap Store Locator] updating the zip code doesn't work’ is closed to new replies.