How to Output Overall Review-count for a Place/Event Category?

This topic contains 10 replies, has 4 voices, and was last updated by  nvoi 10 years, 7 months ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
  • Author
    Posts
  • #3612

    loading…
    Free User
    Post count: 44

    Hi Guys!

    I would like to know if there is any way to get the overall review-count for a place/event category and display it on the front-end?

    Thanks!

    #3616

    Vikas
    Full Member
    Post count: 1128

    I am not sure at which place u would like to show the rating.
    If u have a look on the demo site here http://wpgeo.directory/ , u can see if a listing has review/rating associated to it then it appears with stars.

    Please advise ?

    Thanks

    #3645

    loading…
    Free User
    Post count: 44

    Dear Vikas!

    I made a custom widget for the front content section. I would like it to work as the widget on yelp’s homepage.

    There’s a list with all the categories. I would like to output the overall review-count belongs to a category. So, not the review-count for one place, but the overall review-count for the given category.

    I’m also interested about how to diplay the current location!?

    Thanks!

    #3650

    Paolo
    Site Admin
    Post count: 31206

    Hi loading…

    please make sure to upload images that are less than 512kb. (possibly a lot less)

    A very complex function must be created to achieve something like that (avarage of ratings of al places in 1 category)

    We would develop it only if a good number of members request it and it would take time, because its development would have to be scheduled according to current priorities.

    Thanks,

    #3671

    loading…
    Free User
    Post count: 44

    Dear Paolo!

    Thank you for your reply!

    I’m not native english, so sorry for my grammar. Maybe I was misleading in my previous post.

    What I mean is something like this: I have a “Restaurants” category, and there’s e.g. 20 restaurant listings in it. Every listing has e.g. 2 reviews. It means that I have 40 reviews in my “Restaurants” category. And I would like to output that “40”, if you know what I mean. Not the average, but the total count of ratings in one category.

    I’m also interested about how to display the current location, anywhere on the page.

    I uploaded the pic again, about my widget. Hope it will help you understand what I mean.

    Thank You!

    #3676

    Paolo
    Site Admin
    Post count: 31206

    still a pretty complex thing to do…

    #3682

    loading…
    Free User
    Post count: 44

    Dear Paolo!

    I’m never done such things like before, but with a $wpdb class and a few line of code, I was able to resolve one of my problem.

    If anyone interested, here’s the code:

    
    
    
    <?php global $wpdb;
    
    	$result = mysql_query(
    	'
    	  SELECT default_category, SUM(rating_count) AS value_sum 
    	  FROM geodir_gd_place_detail
    	  WHERE default_category = "2"
    	  GROUP BY default_category;                                    
    	'
    	);
    
    	$row = mysql_fetch_assoc($result);
    	$sum = $row['value_sum'];
    	echo $sum;
    ?>
    

    In this example my “Restaurants” default category has the id=2. Right now it’s only works with default categories, but I’m still working on it. I will like to use gd_default_category instead of default_category column.

    Keep up the good work, Guys!

    #3715

    Vikas
    Full Member
    Post count: 1128

    use this query
    replace 2 with ur desired category id.

    select sum(

    overall_rating

    ) , FIND_IN_SET(2, gd_placecategory) from geodir_gd_place_detail group by FIND_IN_SET(2, gd_placecategory)

    #3732

    loading…
    Free User
    Post count: 44

    Dear Vikas!

    Thank you for your reply!

    I will check it out when I got home, and let you know!

    Best Regards

    #3755

    loading…
    Free User
    Post count: 44

    Dear Vikas!

    Your query doesn’t work for me, unfortunately.

    This is my working solution:

    
    
    
    SELECT SUM(rating_count) 
    FROM geodir_gd_place_detail 
    WHERE FIND_IN_SET('2',gd_placecategory);
    

    Now, I have to try and make it work with the selected location. Let’s say a city. So, it would only count the ammount of “Restaurants” reviews, if the restaurants are located in the selected city. 😀

    #5544

    nvoi
    Free User
    Post count: 52

    This just shows how many things are possible that the developers are not considering/looking into.

    I will let my theme rest and see what has happened in 3 months, if not I’ll have my own theme developed.

Viewing 11 posts - 1 through 11 (of 11 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
20% Discount Offer
Hurry! Get your 20% discount before it expires. Get 20% Discount