• Resolved ixray

    (@ixray)


    I’ve updated my events-list-grouped.php template to include a map like so
    echo em_get_locations_map_shortcode($_REQUEST);

    It works as expected and also updates the map if I search using the category selector. However, if I search for an event using the text field, the map says “No locations found” even though the event list returns several results.

    I have found this thread where Marcus said

    also, for you and others, this doesn’t mean the search text field will work, because what this does is take the search attributes supplied by the form and passes it onto the shortcode function, which accepts some things (e.g. scope, category, location, etc.) but not search (i.e. text search)

    Is this still not possible?

    https://wordpress.org/plugins/events-manager/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support angelo_nwl

    (@angelo_nwl)

    unfortunately yes and might need additional coding on your part to make this work.

    Thread Starter ixray

    (@ixray)

    Thanks, Angelo. I’ve checked again and it does not work with the country selector, either. What’s the point of the global map then if it can’t be updated with search results?

    Thread Starter ixray

    (@ixray)

    To clarify: Map shows search results if I select a category and a country in the Ajax search form (see #1 below), but not if I select (only) a country (#2). Is that expected behavior?

    Output in em-locations-map-coords div:

    #1(map shows results)
    {"action":"search_events_grouped","em_search":"","geo":"","near":"","category":"518","country":"DE","near_distance":"200","near_unit":"km","em_ajax":true,"width":"100%","height":"100%","query":"GlobalMapData","random_id":"37c25"}

    #2 (map shows no locations found)
    {"action":"search_events_grouped","em_search":"","geo":"","near":"","category":"-1","country":"DE","near_distance":"200","near_unit":"km","em_ajax":true,"width":"100%","height":"100%","query":"GlobalMapData","random_id":"6e603"}

    Thread Starter ixray

    (@ixray)

    The problem is that “-1” is being passed as a category ID to the map if “all categories” is selected in the search form.

    As a workaround I’ve come up with a piece of code that replaces “-1” with a comma-separated list of all category ids:

    if ($_REQUEST['category'] == "-1") {
    	$terms = get_terms( 'event-categories' );
    	if ( ! empty( $terms ) && ! is_wp_error( $terms ) ){
    	    foreach ( $terms as $term ) {
    	       $categories .= $term->term_id . ',';
    		}
    	}
    	$_REQUEST['category'] = $categories;
    }
    echo em_get_locations_map_shortcode($_REQUEST);

    Add this to your templates/events-list.php

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Update global map with search results’ is closed to new replies.