Found a solution that pretty much fixes it, but there's one problem.
All products get 5 stars even though they're not rated yet.
Here's the code I've added:
- Code: Select all
<?php
if ($this->showRating) {
$maxrating = VmConfig::get('vm_maximum_rating_scale',5); if (empty($this->rating)) { ?>
<span class="vote">
<span title=" <?php echo (JText::_("COM_VIRTUEMART_RATING_TITLE") . $this->rating->rating . '/' . $maxrating) ?>" class="vmicon ratingbox" style="display:inline-block;"> <span class="stars-orange" style="width:<?php echo $ratingwidth;?>%"> </span> </span>
<span class="rating-title"><?php echo JText::_('COM_VIRTUEMART_RATING').' '.JText::_('COM_VIRTUEMART_UNRATED') ?></span> </span> <?php } else { $ratingwidth = ( $this->rating->rating * 100 ) / $maxrating;//I don't use round as percetntage with works perfect, as for me ?> <span class="vote">
<span title="" class="vmicon ratingbox" style="display:inline-block;"> <span class="stars-orange" style="width:<?php echo $ratingwidth;?>%"> </span> </span>
<span class="rating-title"><?php echo JText::_('COM_VIRTUEMART_RATING').' '.round($this->rating->rating, 2) . '/'. $maxrating; ?></span> </span> <?php } ?> <?php } ?>
Can you see what's wrong?