Author Topic: Access to product rating from within another template page.  (Read 2516 times)


  • Jr. Member
  • **
  • Posts: 68
Access to product rating from within another template page.
« on: October 20, 2009, 03:46:48 am »
I want to customize the way "product rating" is displayed in a product box depending upon what I page I am on.

For example I have taken featuredProducts.tpl.php and modified it to display it much differently than the standard template.  But don't want to modify the way browserx.tpl.php displays.

What I want to do is display just the "stars" in featuredProducts.tpl.php if there is a rating.  I don't want to change votes_allvotes.tpl.php, I just want to have access to the variables in it like $rating so I can do something like:

Code: [Select]

$rating = $featured["product_rating"];
<img src="<?php echo VM_THEMEURL ?>images/stars/<?php echo $rating ?>.gif" align="middle" border="0" alt="<?php echo $rating ?> stars" />

to get the image of the rating.  However, I don't know how to get access to "product_rating" from within featuredProducts.tpl.php.

It does not seem that the $featured is the same type of object or has access to the same variables that are available on the browser pages......  (Reading the VirtueMart 1.1 Developer Manual).  How do I get a hold of the product variables available there?   

thank you very much.  Sorry about the ramble, it's late in the evening.

Stephen McConnell
CoffeStain Software & Design

"Boredom is a personal defect."
  -- Lamar Stephens