Home Forums Plugin Support WP User Frontend (Free Version) Google Map Field Autocomplete

This topic is: resolved

This topic contains 27 replies, has 4 voices, and was last updated by  Tareq Hasan 5 years, 10 months ago.

Viewing 15 posts - 1 through 15 (of 28 total)
  • Author
    Posts
  • #2327

    cedric_charles
    Participant
    Post count: 8

    Hi Tareq !

    Is there a way to add autocompletion to the google address field ? It woul be very usefull ๐Ÿ™‚ !

     

    Thanks !

    #2342

    Tareq Hasan
    Keymaster
    Post count: 2831

    I think it can be done, thanks for the suggestion.

    #2423

    noomia
    Participant
    Post count: 115

    Will you plan to add this ๐Ÿ™‚ ? I think it could be great ! I've done this in a project, but would like to see that in WPUF ๐Ÿ™‚

    #2703

    noomia
    Participant
    Post count: 115

    Is there a way to do that right now ?

    #2739

    Tareq Hasan
    Keymaster
    Post count: 2831

    Feature has been landed a quick fix ๐Ÿ˜‰

    Insert this JS snippet in the `/class/render-form.php`.
    [js]
    function autoCompleteAddress(){
    if (!$input_add) return null;

    $input_add.autocomplete({
    source: function(request, response) {
    // TODO: add ‘region' option, to help bias geocoder.
    geocoder.geocode( {‘address': request.term }, function(results, status) {
    response(jQuery.map(results, function(item) {
    return {
    label : item.formatted_address,
    value : item.formatted_address,
    latitude : item.geometry.location.lat(),
    longitude : item.geometry.location.lng()
    };
    }));
    });
    },
    select: function(event, ui) {

    $input_area.val(ui.item.latitude + ‘,' + ui.item.longitude );

    var location = new window.google.maps.LatLng(ui.item.latitude, ui.item.longitude);

    gmap.setCenter(location);
    // Drop the Marker
    setTimeout( function(){
    marker.setValues({
    position : location,
    animation : window.google.maps.Animation.DROP
    });
    }, 1500);
    }
    });
    }

    autoCompleteAddress();
    [/js]

    Insert this function after `geocodeAddress` function (it's in line: 1517). You also need to add jQuery UI Autocomplete script in your theme/plugin. Inserting `wp_enqueue_script( ‘jquery-ui-autocomplete' );` to the right place will add jQuery UI Autocomplete script.

    #2751

    noomia
    Participant
    Post count: 115

    Hi Tareq !

    Nice ๐Ÿ™‚ ! Do you plan to add it in a future update ? Cause now if I add this snippet, it will be removed at next update ;).

    Thanks ๐Ÿ™‚ !

    #2754

    Tareq Hasan
    Keymaster
    Post count: 2831

    Yes, it's already been added and will come in the next update.

    If you like the plugin and support, I would love to have a testimonial from you ๐Ÿ™‚

    #2757

    noomia
    Participant
    Post count: 115

    Sure I will ๐Ÿ˜‰ !

    Do you approximatively know when the next version will be released ? More than a week ?

    Thanks ๐Ÿ™‚ !

    #2758

    Tareq Hasan
    Keymaster
    Post count: 2831

    I am not sure about the date, there isn't any feature that you need to wait for ๐Ÿ˜‰

    #3306

    amelaunsworth
    Participant
    Post count: 27

    hi there,
    is the Google map only for coordinates? and you need another text field to enter and save one's address?

    Or is there a way that the Google maps retrieves coordinates and saves the address as well?
    because right now i had to add two fields for customer's to enter their address. one to save their address to their profile and one to save coordinates for google map.

    form: http://www.godurhamregion.com/register-form/

    is this how it's supposed to be?

    #3308

    Tareq Hasan
    Keymaster
    Post count: 2831

    Right now, the map field only saves the co-ordinates, it doesn't include the address field. But also, we can save the address field from that field perhaps. Using this code should do this (paste in themes functions.php).

    [php]
    function wpufe_inesrt_address( $user_id ) {
    if ( isset( $_POST[‘find-address'] ) ) {
    update_user_meta( $user_id, ‘address', $_POST[‘find-address'] );
    }
    }

    add_action( ‘wpuf_after_register', ‘wpufe_inesrt_address' );
    [/php]

    #3311

    amelaunsworth
    Participant
    Post count: 27

    Form:
    http://www.godurhamregion.com/register-form/

    Listing:
    http://www.godurhamregion.com/item/test-3/

    hi there, thank you for responding so quickly!! i removed the extra address field and left only the google maps (also added code to functions.asp page) and it still only saves gps coordinates. no actually address. can you assist further?

    also, the image uploaded is not showing up. i am using the Image Upload function. meta key is image. not sure if you can help me with this.

    thanks for your help!!! really appreciate it.

    #3323

    Tareq Hasan
    Keymaster
    Post count: 2831

    I think it stores the address, you can't see it in the form because it's not saving on a form field. It's saving in a user meta field. You can check it in your database may be.

    Images not showing up where? In the post? Make sure you've checked the settings “Custom Fields in post” from plugin settings.

    #3326

    amelaunsworth
    Participant
    Post count: 27

    hey buddy,
    i've tried everything! i'm not a programmer, so i'm struggling.

    i still can't get the image to show up on my listing page using the image upload custom field. i tried all meta keys: image, upload_image, images. i even added the file upload field. can you help?

    the code you sent for functions.asp still doesn't work for me. i have to use a custom field called Address. it's supposed to show up beside the description like this page: http://www.godurhamregion.com/item/sport-chek-harmony/

    been at this all! i'm not a programmer…if you can help me, i would really appreciate it. these are the last two items i need to do and then i can launch.

    http://www.godurhamregion.com/register-form/

    http://www.godurhamregion.com/item/spa-sedona-2/

    #3327

    Tareq Hasan
    Keymaster
    Post count: 2831

    Is that a post creation form or user registration form? I gave you the code for user registration form.

Viewing 15 posts - 1 through 15 (of 28 total)

The topic ‘Google Map Field Autocomplete’ is closed to new replies.