Marker ratings, show likes?

New home Forums Gold Add-on General queries Marker ratings, show likes?

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #80569
    F225
    Participant

    When using the likes/thumbs up/down function, is it possible to show the amount of likes to the user?

    Also wondered, when enabling Caching (beta) are the custom marker icons supposed to revert to the default? Because they do if i enable it.

    #80612
    Matthew
    Moderator

    Hi there,

    Thank you for getting in touch with us, we do appreciate your time.

    Displaying the respective rating statistics should be possible with the help of some custom scripts, thus please may you provide me with the link to your map so that I may take a closer look?

    With regards to the caching functionality, this should not revert your marker icons back to default, thus this is most likely a bug within this feature as it is still in Beta. I have logged this issue to be looked into and resolved in its Beta phase. Thank you so much for finding and reporting this as this is great for improving features which are in Beta phase.

    I look forward to hearing back from you.

    Kindest Regards,
    Matthew

    #80618
    F225
    Participant
    This reply has been marked as private.
    #80635
    Matthew
    Moderator

    Hi there,

    Thank you for getting back to me and for your time on this.

    Unfortunately it is currently only possible to display the average rating and the total number of rating, thus please see the custom JS code that I have written for you below:

    jQuery(function($){
        $(document).on('infowindowopen.wpgmza', function(event){
            let infowindow = $(event.target.element);
            let marker = event.target.feature;
    
            let rating = marker.rating;
            setTimeout(function(){
                if(parseInt(rating.count) > 0){
                    let ratingContainer = infowindow.find('.wpgmza-rating');
                    $('<p>Average Rating: ' + parseFloat(rating.average).toFixed(2) + ' (' + rating.count + ')</p>').appendTo(ratingContainer);
                }
            },500)
        })
    
        $(document).on('markerlistingupdated.wpgmza', function(){
            $('.wpgmaps_mlist_row').each(function(){
                let row = $(this);
                let marker = WPGMZA.maps[0].getMarkerByID(row.attr('data-marker-id'));
    
                let rating = marker.rating;
                setTimeout(function(){
                    if(parseInt(rating.count) > 0){
                        let ratingContainer = row.find('.wpgmza-rating');
                        $('<p>Average Rating: ' + parseFloat(rating.average).toFixed(2) + ' (' + rating.count + ')</p>').appendTo(ratingContainer);
                    }
                },500)
            })
        })
    })

    Please may you save this code in the “Custom JS” setting block and confirm if this helps?

    Kindest Regards,
    Matthew

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