cancel
Showing results for 
Search instead for 
Did you mean: 

PHP Fatal error: Call to a member function getRatingSummary

PHP Fatal error: Call to a member function getRatingSummary

Hi,

 

My webshop is offlline and I can not acces both the admin panel or frontend, "

Exception printing is disabled by default for security reasons.

Error log record number: 1188968715773"

 

The error_log file says : 

 

[10-Feb-2018 03:41:45 Europe/Amsterdam] PHP Fatal error: Call to a member function getRatingSummary() on null in /public_html/app/design/frontend/mgstheme/ethan/template/catalog/product/view.phtml on line 369

 

<div itemtype="http://schema.org/AggregateRating" itemscope="" itemprop="aggregateRating">
		<?php $rating_summary = $_product->getRatingSummary();?>  
		<meta itemprop="ratingValue" content="<?php echo $rating_summary->getRatingSummary()/20; ?>">
		<meta itemprop="ratingCount" content="<?php echo $rating_summary->getReviewsCount(); ?>">
	  </div>

 

 

Does anyone know what I have to do? It returns a NULL? 

 

1 REPLY 1

Re: PHP Fatal error: Call to a member function getRatingSummary

Hello Moerdoe,
You simply need to add the following line to your code start.

$_product = Mage::registry('current_product');

and your final code will look like this.

<php
$_product = Mage::registry('current_product');
?>
<div itemtype="http://schema.org/AggregateRating" itemscope="" itemprop="aggregateRating">
		<?php $rating_summary = $_product->getRatingSummary();?>  
		<meta itemprop="ratingValue" content="<?php echo $rating_summary->getRatingSummary()/20; ?>">
		<meta itemprop="ratingCount" content="<?php echo $rating_summary->getReviewsCount(); ?>">
</div>

 

Was my answer helpful? You can accept it as a solution.
175+ Professional Extensions for M1 & M2
Need a developer?Just visit Contact Us Now