rating active stars calculation

18.10.2018 18:53
#1
Piterchess
Joomshopping forum user no avatar
Name: Pavel
29.10.2016
Posts: 8
Quote
rating active stars calculation

Hello!

in the config I've set max allowed stars to 5, but when it's 5 then active calculated to 10

inactive stars div is 80px and shows 5 stars as it is supposed to
active stars div is 144px and shows 10 active stars

please see screenshot attached
rating active stars calculation


Joomla: 3.8.13
JoomShopping: 4.18.2
PHP: 7.1.11
MySQL: 5.7.21-20-beget-5.7.21-20-1-log
Website Url: https://64ab.ru
 
18.10.2018 18:55
#2
Piterchess
Joomshopping forum user no avatar
Name: Pavel
29.10.2016
Posts: 8
Quote
Aw: rating active stars calculation

на всякий случай еще на русском:

неправильно показываются активные звезды в рейтинге. в настройках стоит 5 звезд, если убрать div с активными - показывается 5 (ширина DIV с неактивными звездами 80 пикселей, а с активными - 144)

 
18.10.2018 20:30
#3
admin
(Support Team)
User admin
Name: Admin
05.08.2010
Posts: 25919
Quote
Aw: rating active stars calculation

Шаблон по умолчанию
http://demo.joomshopping.com/index.php/shop/cars

 
18.10.2018 20:53
#4
Piterchess
Joomshopping forum user no avatar
Name: Pavel
29.10.2016
Posts: 8
Quote
Aw: rating active stars calculation

ну одну проблему я нашел - раньше было доступно 10 звезд, и они так и остались в базе данных _jshopping_products_reviews
сейчас поделил их все на 2, получил правильные оценки. в каждом рейтинге теперь показывается правильно (в отзывах), а вот общий рейтинг для товара считается неправильно. сдается мне вот в это функции что-то не так
или откуда-то еще туда прилетает неправильный рейтинг


function showMarkStar($rating){
$jshopConfig = JSFactory::getConfig();
$count = floor($jshopConfig->max_mark / $jshopConfig->rating_starparts);
$star_width = $jshopConfig->rating_star_width;
$width = $count * $star_width;
$rating = round($rating);
$width_active = intval($rating * $star_width / $jshopConfig->rating_starparts);
$html = "<div class='stars_no_active' style='width:".$width."px'>";
$html .= "<div class='stars_active' style='width:".$width_active."px'>";
$html .= "</div>";
$html .= "</div>";
return $html;
}

 
18.10.2018 20:54
#5
Piterchess
Joomshopping forum user no avatar
Name: Pavel
29.10.2016
Posts: 8
Quote
Aw: rating active stars calculation

а, нашел. надо пересчитать average_rating в таблице _jshopping_products

 


Copyrights MAXXmarketing GmbH. Alle Rechte vorbehalten
Durch die Nutzung dieser Website stimme ich zu, dass Cookies zur optimalen Gestaltung der Website sowie zur Analyse der Nutzung der Website verwendet werden. Weiterführende Informationen finden Sie hier. OK, einverstanden.