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

How to show ratingcount

Started by VopoloS, January 24, 2016, 11:14:59 AM

Previous topic - Next topic

VopoloS

How to show on the item card :
<span itemprop="ratingCount"><?php echo $ratingcount ?></span>

How to get $ratingcount
?
Virtuemart 3.0.12

GJC Web Design

have you checked the $this->product object to see if rating is there?
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

VopoloS

Quote from: GJC Web Design on January 24, 2016, 12:42:30 PM
have you checked the $this->product object to see if rating is there?
Checked. Inserted in the template file productdetails/default.php code: <?php echo $this->product->ratingcount; ?>. No data

GJC Web Design

so there is a node called $this->product->ratingcount but it is empty?
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

Spiros Petrakis

Please use this to get the number of ratings in the product page


<?php
$ratingModel 
VmModel::getModel('Ratings');
 
$productrating $ratingModel->getRatingByProduct($this->product->virtuemart_product_id);
?>

<span itemprop="ratingCount"><?php echo $productrating->ratingcount?></span>


Btw structured data is already available in the product page if you use the default virtuemart theme but you can also easily added to your template by adding this code in the product view


<?php
if ($this->product->prices['salesPrice'] > 0) {
  echo 
shopFunctionsF::renderVmSubLayout('snippets',array('product'=>$this->product'currency'=>$this->currency'showRating'=>$this->showRating));
}
?>

Joomla templates and extensions development
https://www.yourgeek.gr

VopoloS

Quote from: Spyros Petrakis on January 24, 2016, 19:47:33 PM
Please use this to get the number of ratings in the product page


<?php
$ratingModel 
VmModel::getModel('Ratings');
 
$productrating $ratingModel->getRatingByProduct($this->product->virtuemart_product_id);
?>

<span itemprop="ratingCount"><?php echo $productrating->ratingcount?></span>


Btw structured data is already available in the product page if you use the default virtuemart theme but you can also easily added to your template by adding this code in the product view


<?php
if ($this->product->prices['salesPrice'] > 0) {
  echo 
shopFunctionsF::renderVmSubLayout('snippets',array('product'=>$this->product'currency'=>$this->currency'showRating'=>$this->showRating));
}
?>



Thank you very much. It worked.