Magento review working out stars out of ten not five - php

It appears my magento reviews are working out the star ratings out of 10 and not 5. I had 10 radio boxes strangely to begin with. After looking in the database I saw I had many entries in the ratings table. After deleting these extra entries, the user now enters star ratings using radio buttons out of 5. Which is now correct. However the star rating other customers see is being worked out still out of 10. So a star rating of 4/5 is showing as 40% on the stars, when it should be 80%. It is half what it should be. How can I change it so it stops working out the stars out of 10?

It's a fairly complex section of Magento, but if you start by poking around Mage_Review_Block_Product_View and Mage_Rating_Block_Entity_Detailed you should be able to find the code that generates the number that determines summary count. It sounds like it's dividing the review total (out of 100) by 10 (10 stars) rather than 20 (5 stars). Without seeing your code its difficult to help any further.

Related

checking for availability for parking spots using laravel and mysql

I have a problem with MYSQL query to get the overlapping with reservations.
We are working at project to book a parking for cars, And we have a problem in searching for availability
if the user searches for a parking between two dates, we need to get the remaining available number of parking.
the problem here is not the overlapping dates and times
for example, we have 3 reservations, the 1st one from 1-3/8, the second is from 3-5/8 and the 3rd is from 5-7/8 and we have 5 available spots, and the user is looking for 1 - 7/8, the remaining available spots is 4, not 2. because each reservation starts after another one is done.
we tried several solutions, like checking every hour of search
but that’s not a good solution especially when searching for long times/dates
This is an image explain what is the problem
Thanks

MYSQL sorting content by rating logic and opinion?

I'm designing a site and don't know how to rate the system in terms of logic.
Outcome is I want an item with 4 stars with 1000 votes to be ranked higher than an item with 1 vote of 5 stars. However, I don't want an item with 1 star with 1000 votes to be ranked higher than an item with 4 stars and 200 votes.
Anyone have any ideas or advice on what to do?
I found these two questions
Sorting by weighted rating in SQL?
MySQL Rating System - Find Rating
and they have their drawbacks and in the first one I don't understand what the winner means by "You may want to denormalize this rating value into event for performance reasons if you have a lot of ratings coming in." Please share some insight? Thank you!
Here's a quick sketch-up of such a system which works by defining a bonus factor xₙ for each flag number. According to your question you want:
x₄*4*1000 > x₅*1*5
and
x₁*1*1000 < x₄*4*200
Setting the factors to for example x₁=1, x₄=2 and x₅=2 will satisfy this, but you will of course want to adjust it and add the missing factors.
He means, you should put rating-data into the event-table (and thus have redundant data) to optimize it for performance.
See the wiki for Denormalization: http://en.wikipedia.org/wiki/Denormalization
The data you have to determine the rank of items is:
average rating
number of ratings
The hard part is probably to make rules for the ranking. Like: If the average rating for an item > 4 and the number of ratings < 4 treat it like rated 3.9
For convenience, I would put this value (how to treat the items for ranking) in the item-table.

Star Rating System, Similar to Amazon

I'm looking at adding a rating system to my site, similar to that seen on Amazon. Basically users can rate the product out of 5 stars.
I've been racking my brains to think of the calculation to get the average customer rating... but I can't think how to do it.
And looking at Amazon's system, I think their caculation may be incorrect. If you take this page for example:
http://www.amazon.co.uk/exec/obidos...2521526-3543861
You can see that the average customer rating should actually be 5 stars as two people have chosen 5 whereas only one has chosen 4.
Any ideas??
You can calculate the average by taking the sum and dividing it by the number of values. In the case of ratings, it is the sum of all ratings divided by the number of ratings.
In the case you site, with ratings 5, 5 and 4, the average is (5+5+4)/3, which is 4.666..., and I'd guess they round to the nearest half yielding 4.5 out of 5.
why not try a jquery plugin?
http://orkans-tmp.22web.net/star_rating/index.html

How to calculate percentage of "equal or better" in mysql DB?

Figuring out a title for this question was hard, but the following is harder for me. I hope anyone can help.
I have a simple MySQL database table. This table is filled with records containing an ID and the number of week-visitors. It has records of 2 year of about 200+ websites.
To summarize, I want to be able to know two things:
1.) - "In week 54 of 2009 the website somethingonline.com had 300 visitors" (Easy of course. I can do this)
2.) - "The webiste sometingonline.com was among the 8% best scoring websites in that week."
Now, how can I get number 2.??? Of course, I want to know that percentage of all websites in every week so I get a list like:
sometingonline1.com - 300 visitors - 8% of the website score like this or better
sometingonline2.com - 400 visitors - 4% of the website score like this or better
sometingonline3.com - 500 visitors - 2% of the website score like this or better
sometingonline4.com - 600 visitors - 1% of the website score like this or better
How can I get these results? Is this possible in one query?
I use MySQL and PHP.
The key is to involve two different "copies" of your visits table. In this query v1 represents the website you're actually looking at. For each of those v1 websites, we'll join to a copy of the visits table, matching any row that covers a site with more visits in the same week.
SELECT v1.website_name, v1.visits, COUNT(v2.id)
FROM visits AS v1
INNER JOIN visits AS v2 ON (v1.week_number = v2.week_number AND v2.visits > v1.visits AND v2.id != v1.id)
WHERE week_number = 54
This will tell you the number of sites that had more visitors. To get that as a percentage, run a separate query to simply count the total number of sites that had any visits in that week. In your PHP script you can then do the simple division to get the percentage you want.

Build a Ranking

I have a newssystem where you can rate News with 1 to 5 stars. In the Database i save the count, the sum and the absolute rating as int up to 100 (for html output, so 5 stars would be 100 1 star would be 20percent.
Now i have three toplists:
Best Rated
Most viewed
Most commented
Last two ones are simple, but the first is kinda tricky.
Before i took that thing over it was all a big mess, and they just put the 5 best rated news there, so in fact if there was a news rated 4.995 with 100k votes and another one with 5 stars at 1 vote, the "better rated" one is on top even if that is obv ridiculous.
For the first moment i capped the list so only news with a certain amount of votes (like 10 or 20) can be in the list.
But i do not really like that. Is there a nice method to kind-a give those things a "weight" with the count or something like that?
Have you considered using a weighted bayesian rating system? It'll weight the results based on the number of votes and the vote values themselves.
You could explore the statistical confidence in the rating perhaps based around the average rating received for all entries and the standard deviation of all votes. While an entry has an average rating of 5, if you only have a few votes then you may not be able to say with more than 90% confidence that the actual rating is above 4.7 say. You can then rate the entries based upon the rating for which you have 90% confidence.
I'm not sure if this meets your requirement of being simple.
You could use median of the user ratings as the total rating.
You would have five fields with eatch article, each one containing how many times the article was rated as n stars. Then you would select the field with the biggest value of all these and that would be your rating. It has the advantage of ignoring the outliers in the ratings.

Categories