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 11 years ago.
We have moved to a support ticketing system and our forums are now closed.
Open Support Ticket-
AuthorPosts
-
June 5, 2014 at 3:33 am #3612
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!
June 5, 2014 at 5:03 am #3616I 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
June 5, 2014 at 2:49 pm #3645Dear 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!
June 5, 2014 at 5:53 pm #3650Hi 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,
June 5, 2014 at 10:27 pm #3671Dear 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!
June 5, 2014 at 11:27 pm #3676still a pretty complex thing to do…
June 6, 2014 at 2:30 am #3682Dear 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!
June 6, 2014 at 1:58 pm #3715use 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)
June 6, 2014 at 4:17 pm #3732Dear Vikas!
Thank you for your reply!
I will check it out when I got home, and let you know!
Best Regards
June 7, 2014 at 2:33 am #3755Dear 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. 😀
June 22, 2014 at 7:05 am #5544This 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.
-
AuthorPosts
We have moved to a support ticketing system and our forums are now closed.
Open Support Ticket