• Resolved woorooo

    (@woorooo)


    Hi guys,

    Is there a way to autozoom map when a person clicks “set address on map” button while adding new listing? So that they could check if the pin is placed correctly. Unfortunately many users don’t zoom in and check assuming that the pin is set where it is needed. But in many cases it’s not.

    I’ve tried adding the default zoom level with this snippet…

    add_action(‘geodir_address_extra_listing_fields’, function( $cf ) {

    global $gd_post,$mapzoom;
    if(empty($gd_post->mapzoom)){
    $mapzoom = 16;
    }
    });

    But the map zooms out automatically once the users changes the default country, so this doesn’t help unfortunately.

    Or maybe there is a snippet that could force minimum map zoom level on ‘add listing page’?

    That would be perfect to solve this problem.

    Thank you.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Stiofan

    (@stiofansisland)

    Hello,

    The bellow code snippet can be added via the plugin “Code snippets” this will set the zoom level on click of set address on map.

    add_action('geodir_add_listing_codeaddress_before_geocode','_my_zoom_on_set_address');
    function _my_zoom_on_set_address(){
    	global $prefix;
    	?>
     jQuery("#<?php echo $prefix.'map';?>").goMap();
    jQuery.goMap.map.setZoom(14);
    	<?php
    }

    Thanks,

    Stiofan

    Thread Starter woorooo

    (@woorooo)

    Worked perfectly, thank you Stiofan ??

    Plugin Author Stiofan

    (@stiofansisland)

    You are welcome ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Autozoom When Click “Set Address on Map”’ is closed to new replies.