News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

Rating Images not showing up

Started by sandstorm, February 06, 2012, 16:18:24 PM

Previous topic - Next topic

remeedella

in all honesty a fresh 2.0.20 or I'm on a fresh 2.0.18 right now it doesn't work out of the box, i just tried a couple of the solutions provided, one of them got them showing i think but wasn't displaying properly in view and was not actually calculating the ratings given, just showing 0 blank stars.

Favazza

Nice (or not) to see more having problems with this...

raycarter

#47
Solution for VM 2.0.12, Stars not showing up, users can post a review after having posted one:

My Vm administrator version is : 2.0.12 (under extenstion->manage->virtuemart).

The solution to all above is this:

1. Copy file default_reviews.php from <root>/components/com_virtuemart/views/product_details/tmpl  TO <root>/templates/<current_template>/html/com_virtuemart/product_details
2. Find the line <input type="hidden" name="task" value="review"/>
3. Add the following line right after it. <input type="hidden" name="created_by" value="<?php echo JFactory::getUser()->id ?>"/>


I had noticed that the reviews in the database table "virtuemart_rating_reviews" didnt have a userid attached to them.

let me know if it helps someone.

Favazza

Do you know what to do to get the stars show on the product itself and not just numbers (i.e 5/5)?

raycarter

#49
To get stars on the product details page:

1.Copy file default.php from <root>/components/com_virtuemart/views/product_details/tmpl  TO <root>/templates/<current_template>/html/com_virtuemart/product_details
2. Find the following <if> condition : if ($this->showRating) {
3. replace the whole block with this:

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

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

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

Favazza

Thanx. Will try that.

But the file default.php from <root>/components/com_virtuemart/views/product_details lies in another directory called tmpl. Is that correct?
What happens when I copy that to the template? I don't want to change anything else on that page...

raycarter

Quote from: Favazza on April 04, 2013, 13:36:48 PM
Thanx. Will try that.

But the file default.php from <root>/components/com_virtuemart/views/product_details lies in another directory called tmpl. Is that correct?
What happens when I copy that to the template? I don't want to change anything else on that page...

Thats correct. i made a mistake. the file is in tmpl folder.
when you copy files to <root>/templates/<current_template>/html they override the original files. this is Joomla's standard practice.

So next time when you update you will not lose these changes.

Favazza

Great.

Kind of worked. It messed up my page a bit, and all products got 5 stars even though they're not rated yet...

raycarter

Quote from: Favazza on April 04, 2013, 17:03:32 PM
Great.

Kind of worked. It messed up my page a bit, and all products got 5 stars even though they're not rated yet...

you may have made some mistake. or maybe your version is different. if its possible, pm me and i can have a look at your files directly. once it works, we can post the solution here for your version of VM.

Favazza

What's your version?
Running 2.0.20b. Perhaps it's the template that sensitive to the changes?!

raycarter

Quote from: Favazza on April 08, 2013, 11:17:21 AM
What's your version?
Running 2.0.20b. Perhaps it's the template that sensitive to the changes?!

i think it is 2.0.12. its possible that some divs are overlapping. but i am more interested in fixing the rating issue for you. it should be fixed. maybe your version has even more bugs.

Favazza

The rating seems to be working with the numbers at least.
Hade a 5 and rated it 1. Now it has 3 (but the product says 3/5). Stars would be so much better...

raycarter

Quote from: Favazza on April 08, 2013, 14:08:44 PM
The rating seems to be working with the numbers at least.
Hade a 5 and rated it 1. Now it has 3 (but the product says 3/5). Stars would be so much better...


pm me your site url and the ftp credentials. i will take a look at it and, hopefully, fix it. the fix could help others too.

Favazza

Thanx for taking your time.

Perhaps it's easier to edit the default.php that's already in my template?
Or are there other changes that has to be made and that is why you transfer the file from components/virtuemart?
This is the code I've got now:

<?php if($this->showRating){
    $maxrating VmConfig::get('vm_maximum_rating_scale',5);
$rating = empty($this->rating)? JText::_('COM_VIRTUEMART_RATING').' '.JText::_('COM_VIRTUEMART_UNRATED'):JText::_('COM_VIRTUEMART_RATING') . round($this->rating->rating) . '/'$maxrating;
echo   $rating;
?>



raycarter

Quote from: Favazza on April 09, 2013, 14:44:09 PM
Thanx for taking your time.

Perhaps it's easier to edit the default.php that's already in my template?
Or are there other changes that has to be made and that is why you transfer the file from components/virtuemart?
This is the code I've got now:

<?php if($this->showRating){
    $maxrating VmConfig::get('vm_maximum_rating_scale',5);
$rating = empty($this->rating)? JText::_('COM_VIRTUEMART_RATING').' '.JText::_('COM_VIRTUEMART_UNRATED'):JText::_('COM_VIRTUEMART_RATING') . round($this->rating->rating) . '/'$maxrating;
echo   $rating;
?>




what you sent has no code for images.


replace the whole block with this and let me know what happens.

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

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

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