Hi,
I'm in VM 3.0.8, trying to pull a list of reviews by providing the product id.
The only function I've found which could do this is the following one.
File administrator/components/com_virtuemart/models/ratings.php line 174, there is the following function:
function getRatingByProduct($product_id,$onlyPublished=true){
$q = 'SELECT * FROM `#__virtuemart_ratings` WHERE `virtuemart_product_id` = "'.(int)$product_id.'" ';
if($onlyPublished){
$q .= 'AND `published`="1" ';
}
$db = JFactory::getDBO();
$db->setQuery($q);
return $db->loadObject();
}
The problem is that it returns only one record, because of $db->loadObject();
Shouldn't it return a $db->loadObjectList()?
If it's a bug, has the issue already been addressed?
Thanks a lot
hem hem...?!?
do you want ratings? or reviews?
They are different
you want the text reviews right?
also: where are you trying to display them?
I think you missed just getReviewsByProduct
$ratingModel = VmModel::getModel('Ratings');
$productrating = $ratingModel->getReviewsByProduct($product->virtuemart_product_id);
I just notice it is missing the publish param