MarkerList with Category Filter

New home Forums Pro Add-on MarkerList with Category Filter

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #61125
    Ugatza
    Participant

    Hi WPGMAP team :

    First, thanks for your excellent plugin, it’s so great.

    Here’s my issue : I want to make a custom page with a simply list of markers, but filtered on a specific category.

    I looked on ajax side the parameters to filter the map for example with a category filter and so I tried this simple code :

    
    $mymap_id=1;
    $mycat_id=131;
    
    $list = new \WPGMZA\MarkerListing($mymap_id);
    
    $params['map_id']=$mymap_id;
    $params['filteringParams'] = array(
    	'map_id' => $mymap_id,
    	'categories' => array($mycat_id)
    );
    
    $results=$list->getRecords($params);
    
    foreach($results->data as $record) {
    	echo $record->id.' > '.$record->title.'<br/>';
    }
    

    Unfortunately, results are not filtered as hoped : filteringParams seems to have no effect.

    Can you direct me?

    Thanks for your help and have a very nice day,

    Best regards,

    • This topic was modified 2 years, 11 months ago by Ugatza. Reason: code format
    #61127
    Steven
    Moderator

    Hi there,

    Thank you so much for getting in touch, we really appreciate your time.

    Just to confirm, you would like only the marker listing to appear on a separate page without the map?

    If so, may I kindly suggest perhaps simply enabling the category filter and inserting the map on that page with the marker listing enable as per normal but then simply hiding the map?

    This should then give you the ability to still use the marker listing along with the category filter?

    I look forward to hearing back from you.

    Kindest Regards,
    Steven De Beer

    #61130
    Ugatza
    Participant

    Hi Steven,

    Many thanks for your quick reply !

    Yes, I just want to display the marker listing without the map.
    But I don’t want a scrolling menu filter with.
    I have around 300+ categories/subcat/subsubcat
    (Although, it could be nice on the administration to fold up the categories tree, I have to scroll sooo much ;))

    I think it should be possible on that way.

    I also tried for each record to load the MarkerPro (not really optimized but I can collect the marker category id to compare it)
    But another problem : category I want to filter is a parent to aprent to this category ^^

    
    foreach($results->data as $record) {
    	$marker = new \WPGMZA\ProMarker($record->id);
    	$json = $marker->jsonSerialize();
    	echo $json['categories'][0].'<br/><br/>';
    }
    
    #61133
    Steven
    Moderator

    Hi again,

    Thank you so much for getting back to me.

    Thank you so much for clarifying slightly.

    Could I kindly suggest perhaps submitting a customization request at the following link? This will then go through to one of our custom feature dedicated developers who might better be able to assist with a request such as this? 🙂

    Kindest Regards,
    Steven De Beer

    #61136
    Ugatza
    Participant

    Hi Steven,

    Sure, i will.
    It’s indeed more oriented backend than frontend 😉

    Sorry but I can’t see your link, should I post into Feature Requests forum ?

    (If my issue is solved, I’ll updated this post with the solution)

    #61141
    Ugatza
    Participant

    OK I found the link in the footer ^^

    #61144
    Steven
    Moderator

    My apologies, I should have attached the link to my response.

    I am glad to hear you managed to locate the link.

    I do hope you have a great weekend ahead!

    Kindest Regards,
    Steven De Beer

    #61173
    Ugatza
    Participant

    Hi there !

    Here’s the solution thanks to the support 😉
    We had to use MarkerFilter class, it works like a charm ^^

    $mymap_id=1;
    $mycat_id=12;
    
    $filteringParameters = array(
    	'map_id' => $mymap_id,
    	'mashupIDs' => array(),
    	'categories' => array($mycat_id)
    );
    $markerFilter = WPGMZA\MarkerFilter::createInstance($filteringParameters);
    foreach($filteringParameters as $key => $value){
    	$markerFilter->{$key} = $value;
    }
    
    $results = $markerFilter->getFilteredMarkers(NULL);
    foreach ($results as $result) {
    	echo $result->id . " > " . $result->title . '<br/>';
    }

    You can flag this topic as [SOLVED]

    Many thanks !

    #61175
    Steven
    Moderator

    Hi Ugatza,

    Thank you so much for getting back to us here.

    I am glad to hear this has helped.

    Do have a fantastic week ahead.

    Kindest Regards,
    Steven De Beer

Viewing 9 posts - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.