Author Topic: Rating inside Virtuemart 3 Products Module  (Read 2262 times)

etna

  • Beginner
  • *
  • Posts: 21
Rating inside Virtuemart 3 Products Module
« 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

jenkinhill

  • UK Web Developer & Consultant
  • Global Moderator
  • Super Hero
  • *
  • Posts: 27108
  • Always on vacation
    • Jenkin Hill Internet
Re: Rating inside Virtuemart 3 Products Module
« Reply #1 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/
Kelvyn

Jenkin Hill Internet,
Lowestoft, Suffolk, UK

Unsolicited PMs/emails will be ignored.

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

Currently using VM 3.4.3.9989 on Joomla 3.9.1 PHP 7.0.32
Testing VM 3.4.3.9993 on Joomla 3.9.1

etna

  • Beginner
  • *
  • Posts: 21
Re: Rating inside Virtuemart 3 Products Module
« Reply #2 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

webpiksel

  • Beginner
  • *
  • Posts: 4
  • A beginner
    • Tanie strony internetowe
Re: Rating inside Virtuemart 3 Products Module
« Reply #3 on: June 02, 2018, 18:12:46 pm »
Code: [Select]
<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>
Tanie strony internetowe dla firm z Płocka, Włocławka, Mławy i Płońska http://www.webpiksel.pl