VirtueMart Forum

VirtueMart 2 + 3 + 4 => Templating & Layouts => Topic started by: jorgepracticum on November 25, 2015, 11:39:27 AM

Title: Rating Stars doesn't load
Post by: jorgepracticum on November 25, 2015, 11:39:27 AM
Hi
I'm using VM 3 and Joomla 3.4.5
I can rate and comment about a product of my shop and I can see those information in the product details tab but in the frontpage of VM I see the stars like nobody votes about the product... I think the problem is in the file: components/com_virtuemart/sublayouts/rating.php
Well, I'm using the shoplab template to show VM, and the same file is in templates/shoplab/html/com_virtuemart/sublayouts/rating.php
In this file, it checks if the product has rating
<?php defined('_JEXEC') or die('Restricted access');

$product $viewData['product'];

if (
$viewData['showRating']) {
        
$maxrating VmConfig::get('vm_maximum_rating_scale'5);
        if (empty(
$product->rating)) {
        
?>

                <div class="ratingbox dummy" title="<?php echo vmText::_('COM_VIRTUEMART_UNRATED'); ?>" >

                </div>
        <?php
        
} else {
                
$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><div class="clear"></div>
        <?php
        
}
}



In the if condition:
if (empty($product->rating))
This line return false when I have one comment and rating about a product. In fact, "$product->rating" is null
In my VM configuration I enable the necesary functions to show and make coments and ratings
What is wrong?
Regards
Title: Re: Rating Stars doesn't load
Post by: jenkinhill on November 25, 2015, 12:48:09 PM
I am using VM3.0.12 on J3.4.5 with VM default templates. I have no problem with the stars showing so you may have to ask the template developer.
Image below is before and then after posting one review giving 4 stars.
Title: Re: Rating Stars doesn't load
Post by: jorgepracticum on November 25, 2015, 12:49:58 PM
Ok
Thanks
I'll ask the template developer
Regards
Title: Re: Rating Stars doesn't load
Post by: jorgepracticum on December 07, 2015, 17:42:02 PM
Hi again
I asked the template developers and they didn't resolve my problem. They only said me that they will fix this in their next release
But I need to solve this now
So I have tried to change the template to check if the error is from template. I have seen that in any template the stars load... So I think that is VirtueMart problem.
How can I trace the execution to try to see what is happening?
Regards

EDITED:
Hi
I was looking the database and I realised that there was a parameter that made me feel strange... The table is #_virtuemart_rating_reviews and the parameter is "review_ok"
I went to VirtueMart's backend and saw all the reviews and votes and I noticed that the review wasn't published. I published it and voilĂ , the stars changed!!
So my question is: Why the review appears on the reviews tab but the stars don't change when the review isn't published?
Regards

EDITED 2:
Hi
I have looked for an option to autopublish the reviews and I found it. The problem is that the option is checked, so it should autopublish the reviews, but it doesn't work
Do you know why this is happening?
Regards and sorry for all message  :'(
Title: Re: Rating Stars doesn't load
Post by: jenkinhill on December 08, 2015, 12:03:24 PM
Autopublish works fine for me, Joomla 3.4.5, VirtueMart3.0.12 with default VirtueMart template. Maybe a template problem?
Title: Re: Rating Stars doesn't load
Post by: jorgepracticum on December 08, 2015, 12:34:25 PM
You mean that the problem is that the template doesn't work good when someone write a review?
I mean, someone write a review and select a number of stars, then he or she click on "Submit comment" and then the template doesn't storage the data properly in the database
Do you mean that?
Regards
Title: Re: Rating Stars doesn't load
Post by: GJC Web Design on December 09, 2015, 09:40:04 AM
check in the database to see if the rating is stored
Title: Re: Rating Stars doesn't load
Post by: jenkinhill on December 09, 2015, 10:55:08 AM
And switch the template to Protostar to see it it works there.
Title: Re: Rating Stars doesn't load
Post by: GJC Web Design on December 10, 2015, 10:58:04 AM
and make sure your VM is up to date..which is why we have updates.. bug fixes and security.. + added features 3.0.12 is current
Title: Re: Rating Stars doesn't load
Post by: jorgepracticum on December 10, 2015, 18:39:16 PM
Hi
The template saves the all rating information properly
And with protostar the problem still persist
I have that version of VM

So I think that the problem is when the component saves the information in the database
Title: Re: Rating Stars doesn't load
Post by: GJC Web Design on December 11, 2015, 12:21:31 PM
Quotecheck in the database to see if the rating is stored

so is it actually in the DB table after saving?
Title: Re: Rating Stars doesn't load
Post by: jorgepracticum on February 02, 2016, 16:09:28 PM
Hi
I'm really sorry about not answer your question. I was too busy to read the forum. I'm sorry
Well, the rating stores in the database it stores properly but the parameter "review_ok" is checked as false (with a 0)
So I think that the problem is that the component doesn't store the information properly in my Joomla
Regards