• Resolved agenziae20

    (@agenziae20)


    Hi,

    I would like to know if these features are available (core or add-on):

    – reload results on map zooming: when zooming in or out the list of results are adapted according to the pinpoints on the map (if I zoom in there will be less results, if I zoom out there will be more results). Which is something that can be achieved changing the “distance” field in the search form.

    – show an empty map if there are no results, instead of not showing the map at all

    Thanks.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Eyal Fitoussi

    (@ninjew)

    Hello @agenziae20,

    1. This feature is not available at the moment. It might be available in one of the extensions in the feature. Until then, it is possible with custom coding only.

    2. It is possible by following the steps below:

    1. You need to display the map using a shortcode. So in the “Form Submission” tab of the form editor, set the “Display Map” dropdown to “Using Shortcode. Then in the page display your form using the shortcodes:
      
      [gmw search_form="form id"]
      [gmw map="form id"]
      [gmw search_results="form id"]
      
    2. add the scripts below to the functions.php file of your theme:

      
      function gmw_custom_show_map_element_without_locations( $gmw ) {
      
      	$gmw['results_map']['no_results_enabled'] = true;
      
      	return $gmw;
      }
      add_filter( 'gmw_pre_search_query_args', 'gmw_custom_show_map_element_without_locations', 50 );
      
      function gmw_custom_enable_map_without_locations( $args ) {
      
      	$args['settings']['hide_no_locations'] = false;
      
      	return $args;
      }
      add_filter( 'gmw_map_element', 'gmw_custom_enable_map_without_locations' );
      

    I hope this helps.

    Thread Starter agenziae20

    (@agenziae20)

    Hello Eyal,

    thank you for your kind answers!

    1) ok, I see. Meanwhile do you have a script for a workaround?
    2) that’s great, it works, thanks! How can I set the map zoom level INSIDE this script to override global settings? I globally use “auto zoom” and it is usually ok, but with no results the zoom is automatically set to maximum level and the user doesn’t understand what happened, so it would be better to set a lower zoom level (let’s say 9) so that the user can see a map display the surroundings.

    Thanks!

    Plugin Author Eyal Fitoussi

    (@ninjew)

    You are welcome, @agenziae20.

    1. Unfortunately, I don’t have such a script at the moment. This is something that I could probably accomplish as custom work if you are interested. It would probably require about 2 hours of work.

    2.Try this script:

    
    function gmw_no_locations_set_custom_zoon_level( $args ) {
    
    	// Set the zoom level when no locations were found.
    	if ( empty( $args['locations'] ) ) {
    		$args['map_options']['zoom'] = 9;
    	}
    
    	return $args;
    }
    add_filter( 'gmw_map_element', 'gmw_no_locations_set_custom_zoon_level', 90 );
    

    I hope this helps.

    Thread Starter agenziae20

    (@agenziae20)

    Hello Eyal,

    1. Thank you, I will think about it
    2. That’s perfect, thank you very much!

    Regards.

    Hello Eyal,

    thanks both functions work fine.

    How can I set the users choosen Radius instead of the zoom level?

    The problem is:

    https://rockspots.de/

    if you search for “Siegen” radius 50 there are no results but the city K?LN/Cologne is shown. But without results.

    If you search for “Siegen” radius 100 the map has results.

    Maybe showing just the radius or easier only the starting map with all results will be more user friendly.

    Denis

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘reload results on map zooming + map with no results’ is closed to new replies.