Author Topic: Rating Images not showing up  (Read 31650 times)

Favazza

  • Jr. Member
  • **
  • Posts: 54
Re: Rating Images not showing up
« Reply #60 on: April 09, 2013, 15:53:33 pm »
It's better design wise.
However allt the products now show 5 stars. Also the product with 2 votes (3/5) still shows 5 stars.

raycarter

  • Beginner
  • *
  • Posts: 39
Re: Rating Images not showing up
« Reply #61 on: April 10, 2013, 19:34:00 pm »
Thats why i said i need to check :( or maybe i update my version to the latest, make the same changes and see if it happens to me too.


Favazza

  • Jr. Member
  • **
  • Posts: 54
Re: Rating Images not showing up
« Reply #62 on: April 17, 2013, 15:22:10 pm »
Haven't sorted this out even though we were closer than ever.
Got the stars to show, but all products showed 5 stars even though there were'nt rated.
Any clues?

raycarter

  • Beginner
  • *
  • Posts: 39
Re: Rating Images not showing up
« Reply #63 on: April 30, 2013, 21:21:57 pm »
Haven't sorted this out even though we were closer than ever.
Got the stars to show, but all products showed 5 stars even though there were'nt rated.
Any clues?

Looks like Joomla template issue. try switching the template from the Template manager. See if it works.

Favazza

  • Jr. Member
  • **
  • Posts: 54
Re: Rating Images not showing up
« Reply #64 on: May 02, 2013, 11:12:34 am »
Do you mean changing to one of the standard templates on the site?

raycarter

  • Beginner
  • *
  • Posts: 39
Re: Rating Images not showing up
« Reply #65 on: May 15, 2013, 17:19:45 pm »
Do you mean changing to one of the standard templates on the site?

Yes. Change it from Extension manager->template manager.

Favazza

  • Jr. Member
  • **
  • Posts: 54
Re: Rating Images not showing up
« Reply #66 on: May 18, 2013, 12:56:52 pm »
Hard to do as site is live  :-[
Tried to ask the creator of the template.
They asked this:

Quote
Can You tell me what is the value of $this->rating->rating when there is no rattings yet ?

Don't understand what that means.

raycarter

  • Beginner
  • *
  • Posts: 39
Re: Rating Images not showing up
« Reply #67 on: May 20, 2013, 06:13:16 am »
Hard to do as site is live  :-[
Tried to ask the creator of the template.
They asked this:

Quote
Can You tell me what is the value of $this->rating->rating when there is no rattings yet ?

Don't understand what that means.

For this, we need to do debugging. I could check it out and fix for sure if only i could get your joomla template on my demo site.

ajaz19

  • Beginner
  • *
  • Posts: 2
  • Skype Name: ajaz19uk
Re: Rating Images not showing up
« Reply #68 on: September 03, 2013, 01:44:53 am »
Hi,

I am experiencing the same issue with the rating system within virtuemart, the stars do not upon entering a new review, therefore the user cannot set a rating. Also, once the review is submitted, the rating is shown within the product details as Rating 5/5 without the stars/images.

I have tried all solutions described in this forum, even followed the recommendation on this site to no avail - http://network.convergenceservices.in/forum/5-components/2630-show-ratings-in-virtuemart-category-page.html

Can a member of virtuemart please assist, I am very close in migrating to a new shopping cart plugin altogether due to the lack of support, but so far I have had minor issues with virtuemart which can be resolved locally.

Your help is appreciated...

Joomla - 2.5.9
virtuemart -  2.0.22a

phobophil

  • Guest
Re: Rating Images not showing up
« Reply #69 on: September 26, 2013, 18:16:44 pm »
It is working now for me with VM 2.0.22c.

1. Hack
/components/com_virtuemart/views/category/view.html.php

line 89 - 91 replace
Code: [Select]
foreach($products as $product){
$product->stock = $productModel->getStockIndicator($product);
}

with
Code: [Select]
$ratingModel = VmModel::getModel('ratings');
     
foreach($products as $product)
{
    $product->stock = $productModel->getStockIndicator($product);
    $product->showRating = $ratingModel->showRating($product->virtuemart_product_id);
    if ($product->showRating)
    {
$product->vote = $ratingModel->getVoteByProduct($product->virtuemart_product_id);
$product->rating = $ratingModel->getRatingByProduct($product->virtuemart_product_id);
    }
}

and right after this (line 94 - 96)
Code: [Select]
$ratingModel = VmModel::getModel('ratings');
$showRating = $ratingModel->showRating();
$this->assignRef('showRating', $showRating);

add these two lines
Code: [Select]
$rating = $ratingModel->getRatingByProduct($product->virtuemart_product_id);
$this->assignRef('rating', $rating);

2. Override
/templates/<yourTemplate>/html/com_virtuemart/category/default.php

line 245 - 253 replace
Code: [Select]
<?php if ($this->showRating) { ?>
<span class="contentpagetitle"><?php echo JText::('COM_VIRTUEMART_CUSTOMER_RATING'?>:</span>
<br/>
<?php
// $img_url = JURI::root().VmConfig::get('assets_general_path').'/reviews/'.$product->votes->rating.'.gif';
// echo JHTML::image($img_url, $product->votes->rating.' '.JText::_('COM_VIRTUEMART_REVIEW_STARS'));
// echo JText::_('COM_VIRTUEMART_TOTAL_VOTES').": ". $product->votes->allvotes;
?>

<?php ?>

with
Code: [Select]
    <?php
    
if ($this->showRating) {
            
$maxrating VmConfig::get ('vm_maximum_rating_scale'5); 
            
$ratingsShow VmConfig::get ('vm_num_ratings_show'3);

            if (empty(
$product->rating)) {
            } else {
                
$ratingwidth = ( $product->rating->rating 100 ) / $maxrating
            
?>

            <span class="vote">
                <?php echo JText::_('COM_VIRTUEMART_RATING') . ' ' round($product->rating->rating2) . '/' $maxrating?><br/>
                <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
        
}
    }
    
?>

No stars when product is not rated.


[attachment cleanup by admin]

Pejo

  • Jr. Member
  • **
  • Posts: 64
Re: Rating Images not showing up
« Reply #70 on: October 16, 2013, 22:39:01 pm »
I have tried every of this code in my template default.php for showing stars in product view, but none of this is working for me.
Always showing only text, never images. Like it is blocked to show images :D

I am still looking for some kind of solutions, so if someone have some new solution or idea how to resolve this, I will really appreciate it.

Just to say that I have inserted stars under category view, and there was no problem, I did it like a charm, but in product view I can not insert it. Like I said, tried all the solutions here and still no luck :( :/

reemet16

  • Beginner
  • *
  • Posts: 8
Re: Rating Images not showing up
« Reply #71 on: November 04, 2013, 17:01:45 pm »
On product page i can only choose 5 stars to rate...does anyone has solution for that?

kiki90

  • Beginner
  • *
  • Posts: 27
Re: Rating Images not showing up
« Reply #72 on: November 27, 2013, 17:32:41 pm »
If any of you guys are experiencing issues on the star rating not showing properly on chrome (especially when you hover over the stars and then refresh and try again), you will see that if you hover over the 5th star only 2 are orange... my guess is that when you look into the html code you'll have this:
Code: [Select]
<input type="hidden" id="vote" value="0" name="vote">sometimes it goes to a negative number therefore no stars show as supposed to ..

trying to find a way so the value won't go below 0

samlf3rd

  • Jr. Member
  • **
  • Posts: 115
Re: Rating Images not showing up
« Reply #73 on: August 19, 2016, 19:06:22 pm »
I just added your CSS to my CSS and it worked thank you! I had to login to thank you for the quick fix! Not sure of any down falls, but at least the stars are there now and they work.
Thanks again Hollywood!
Somethings are waay more easier than we make them out to be...

For those who don't know on this and are making a custom template here is what you may need to do if you are using your own css.

Make sure you copy & paste these lines in your style sheet from virtuemart-ltr.css:
Code: [Select]
.ratingbox {
position:relative;
display:block;
width:120px;
height:24px;
background:url("pathto/images/color-stars.png") repeat-x scroll 0 bottom transparent;
}
.ratingbox span {
background:url(pathto/images/color-stars.png) repeat-x;
display:block;
width:1%;
height:24px;
position:absolute;
}
.stars-orange{background-position:0 0 !important;}
.stars-red{background-position:0 -54px !important;}
.stars-green{background-position:0 -108px !important; }
.stars-blue{background-position:0 -162px !important;}
.stars-purple{background-position:0 -216px !important;}

You will need this somewhere in your productdetails default.php page:

Code: [Select]
<?php
if ($this->showRating) {
    $maxrating VmConfig::get('vm_maximum_rating_scale',5);

if (empty($this->rating)) { ?>

<span class="vote"><?php echo JText::_('COM_VIRTUEMART_RATING').' '.JText::_('COM_VIRTUEMART_UNRATED'?></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">
<?php echo JText::_('COM_VIRTUEMART_RATING').' '.round($this->rating->rating2) . '/'$maxrating?><br/>
<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>
<?php
}
}
?>

You'll notice that it not only takes care of the rated image, it will also handle the JS review and ratings display..

it really is that easy...the main thing was that I missed the css for this and that is what really gave me a headache...I was overthinking it way too much.

djgorandj

  • Beginner
  • *
  • Posts: 2
Re: Rating Images not showing up
« Reply #74 on: April 24, 2018, 12:22:21 pm »
This is correct code to show raiting:

public_html/templates/template name/html/com_virtuemart/productdetails/default.php
Code: [Select]
<?php
$ratingModel VmModel::getModel('ratings');
  $showRating $ratingModel->showRating($this->product->virtuemart_product_id);
 if ($showRating=='true'){
//var_dump ($showRating);
$rating $ratingModel->getRatingByProduct($this->product->virtuemart_product_id);
if( !empty($rating)) {
$r $rating->rating;
} else {
$r 0;
}
$maxrating VmConfig::get('vm_maximum_rating_scale',5);
$ratingwidth = ( $r 100 ) / $maxrating;//I don't use round as percetntage with works perfect, as for me
?>

  <?php  if( !empty($rating)) {  ?>                       
<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($rating->rating2) . '/'$maxrating?></span>
</span>
   <?php } else { ?>
  <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').' '.JText::_('COM_VIRTUEMART_UNRATED'?></span>
   </span>
<?php }
}
?>