VirtueMart Forum

VirtueMart 2 + 3 + 4 => Frontend Modules => Topic started by: etna on April 28, 2015, 09:14:37 AM

Title: Rating inside Virtuemart 3 Products Module
Post by: etna on April 28, 2015, 09:14:37 AM
Hi
I was using this to show the rating stars in Featured Products Module in VM 2 but it looks that is not working in VM 3, any help?
Quote
<?php
               if (!empty($product->rating)):
                  $ratingwidth = ( $product->rating->rating * 100 ) / $maxrating; ?>
                  <span class="rating">
                     <span title=" <?php echo (JText::_("COM_VIRTUEMART_RATING_TITLE") . $product->rating->rating . '/' . $maxrating) ?>" class="vmicon ratingbox" style="display:inline-block;">
                        <span class="stars-orange" style="width:<?php echo $ratingwidth.'%'; ?>"></span>
                     </span>
                  </span>
               <?php else:?>
                  <span>not rated yet </span>
<?php endif ?>

Thanks

Joomla 3.4.1
VM 3.0.8
PHP 5.3.29
Title: Re: Rating inside Virtuemart 3 Products Module
Post by: jenkinhill on April 28, 2015, 12:13:50 PM
Ratings in VM modules show by default in VM3.0.8 when using VM default templates. eg see latest/featured on http://demo.virtuemart.net/
Title: Re: Rating inside Virtuemart 3 Products Module
Post by: etna on April 29, 2015, 08:58:50 AM
Thank you for the answer but these products, that have rating here http://demo.virtuemart.net/ (Featured - Latest - Top Ten) are part of the VM frontpage and are controlled by the ../com_virtuemart/sublayouts/products.php.
My question is about "Products module" that is inside ../modules/mod_virtuemart_product/tmpl/default.php, that does not contain code for the rating.
So the question remain.

Regards
Title: Re: Rating inside Virtuemart 3 Products Module
Post by: webpiksel on June 02, 2018, 18:12:46 PM
<div class="vm-product-rating-container">
<?php             
       $ratingwidth 
$product->rating 24?>

                 <div title=" <?php echo (vmText::_("COM_VIRTUEMART_RATING_TITLE") . round($product->rating) . '/' $maxrating?>" class="ratingbox" >
  <div class="stars-orange" style="width:<?php echo $ratingwidth.'px'?>"></div>
</div>