Display all current queries on the map

Home Forums MapPress Support Display all current queries on the map

Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #11897
    p36p
    Participant

    hi,

    I have 15 results per page and I have as parameter : <?php echo do_shortcode(‘[mashup query="current" width="1050" height="350"]‘); ?> to displau my results on a map. That works perfectly !

    When I have more than 15 results, it’s organised by pagination (like result page 1, result page 2, result page 3…)

    Is it possible to display all results that meet my request on the map instead of only the one on the page (display ALL current QUERIES instead of all current RESULTS on the page)?

    Sorry for my english, If I’m not clear enough don’t hesitate to make me explain differently.

    Thank you for your help and congrats for this awesome plugin !

     

    #11902
    Chris
    Keymaster

    Hi,

    I’m not sure I understood, but query=”current” means show only what’s on the current page.  These queries will show ALL maps in your blog:

    query=”posts_per_page=-1&post_type=any”

    query=”all”

    There are also some examples using post type, taxonomies, categories, etc. in the documentation:

    http://mappresspro.com/mappress-documentation

    I hope that helps…

     

    #11904
    p36p
    Participant

    Hi Chris,

    Thanks for your answer and sorry for my english, it’s not my native language

    Yes, I tried this one (query=”posts_per_page=-1&post_type=hotels”) , but it displays all the hotels on the map (not the hotel related to my research).

    For example, say I have 600 registered hotels in my database.

    I search all the hotels located in Paris.

    I have a list of 50 hotels as results, of which only 15 are displayed as the first page of results, then the other over 3 other pages.

    –> Currently, the map shows only the 15 results of the current page.

    What I am looking to do is display all the 50 results on the map (but only results related to my research on paris, so 50 hotels)

    I checked the documentation but I did not find any solution

    I hope this is more understandable !

    #11905
    Chris
    Keymaster

    Hi,

    Ah, I see what you mean now.  I’m sorry, but when you use “current” the plugin takes the original query results exactly.  It’s not possible to modify its parameters because it doesn’t re-run the query.

    Maybe you could instead modify your do_shortcode() to use the query arguments from the page.

    For example the parameter ‘s’ in the page URL is usually the search.  This would then show you all hotels matching the current search (like “Paris”):

    <?php 
    	$s = isset($_REQUEST['s']) ? "s=" . $_REQUEST['s'] : "";
    	$query = "post_type=hotels&posts_per_page=-1&" . $s;
    	echo do_shortcode('[mashup query="' . $query . '" width="1050" height="350"]');
    ?>
    #11906
    p36p
    Participant

    It works ! thank you so much !

    EDIT: It worked because it displays all the hotels (I made a global research and it displayed all the hotel instead of the first 15)

    But, It doesn’t work for Paris : All the hotels are displayed for every research.

    I think you are very close ! Do you know what could be the reason?

    #11907
    p36p
    Participant

    I guess theere is an error in : “post_type=hotels&posts_per_page=-1&”

    the “&” is wrong, right ?

    I corrected this anyway but it shows all the hotels

    #11908
    Chris
    Keymaster

    Hi,

    The “&” needs to be there, but only if there’s a search.   Here’s the code with that change.  I also added an “echo” at the bottom so you can see the page parameters:

    <?php 
    	$s = isset($_REQUEST['s'])?"&s=". $_REQUEST['s']:"";
    	$query ="post_type=hotels&posts_per_page=-1". $s;
    	echo do_shortcode('[mashup query="'. $query .'" width="1050" height="350"]');
    
    	echo "<br/>";
    	echo "This is the request on the page: " . print_r($_REQUEST, true);
    ?>
    #11913
    p36p
    Participant

    Hi Chris,

    the list of result is right, I have all the hotels that meet the query. But the map seems to do not work correctly

    I have only part of the results displayed on the map on for some query I do not have any results on the map at all

    The page parameters seems to be ok

    #11917
    Chris
    Keymaster

    Hi,

    I don’t know, perhaps if you send a URL I can see it.  If you like, use the contact form to send a login as well it would help if I can see the backend too.

    #11918
    p36p
    Participant

    OK I Send it to you right now

    #11919
    p36p
    Participant

    I sent you an access with URL and for the tests I have displayed two maps :

    ——-> one with the snippet you provided :

    <?php

    $s = isset($_REQUEST[‘s’])?”&s=”. $_REQUEST[‘s’]:””;

    $query =”post_type=typefichehotel&posts_per_page=-1″. $s;

    echo do_shortcode(‘[mashup query="'. $query .'" width="1050" height="350"]‘);

    echo “<br/>”;

    echo “request format: ” . print_r($_REQUEST, true);

    ?>

    (notice: “typefichehotel” is the right name of my custom content, but it search on every types btw)

    ——-> then one with the simple mashup shortcode :

    <?php echo do_shortcode(‘[mashup query="current" width="1050" height="350" ]‘);?>

     

    #11936
    p36p
    Participant

    Hi Chris

    did you received my Mail with the access ?

    regards

    #11947
    Chris
    Keymaster

    Hi,

    I think this is resolved and I’ll close the thread.

    For anyone else looking through: in this case the MapPress query was in fact working, but another plugin (‘search everything’) was altering the query parameters.

    So a search with “s=xyz” was in fact being converted to a search by tag “region=xyz”.

Viewing 13 posts - 1 through 13 (of 13 total)
  • The topic ‘Display all current queries on the map’ is closed to new replies.