Author Topic: Show product rating on productsnapshot  (Read 9289 times)

suporte7p

  • Beginner
  • *
  • Posts: 1
Show product rating on productsnapshot
« on: February 01, 2013, 18:11:12 PM »
Hello folks! Good morning! I'm getting started on Joomla and Virtuemart by now and I am having some difficulties on develop one website. I would like to present to the user the product rating. I have already configured Virtuemart to show on subpages the product rating editing browse_4.php, and now I need to edit productsnapshot.tpl.php to show the same information on the first page.

The thing is that I'm doing exactly like I did on browse_4.php inserting <?php echo $product_rating ?>, but nothing shows up. On this same page I can show without any trouble $product_name, $product_link, etc. Could someone guide me to acomplish this?

I have already edited the file "productsnapshot.tpl.php" and added this:

<?php
/* SHOW RATING */
$product_rating = ps_reviews::allvotes( $product_id );
?>

<?php echo $product_rating ?>



Then, I edited the file "ps_reviews.php" on the folder "/administrator/components/com_virtuemart/classes" about the line 44 replacing:

global $db;


For this:

$db = new ps_DB();

According to the user on the official forum this change should work and wouldn't stop the product rating on any page. But when I apply this code the site returns a fatal error:

Fatal error: Class 'ps_reviews' not found in /home/comercialalvorada/www/loja/components/com_virtuemart/themes/default/templates/common/productsnapshot.tpl.php on line 40

Do I need to insert a require_once on this class inside productsnapshot.tpl.php?