Keyword

K2 Rating on Google

  • Goble002
  • Goble002's Avatar Topic Author
  • Offline
  • Premium Member
More
7 years 4 months ago #159441 by Goble002
K2 Rating on Google was created by Goble002
Hello,

I've searched a bit on the forum but the related posts are a bit old.

Running K2 2.7.1 with template override. Is there actually a plugin that can be used to get Rating Value for Google Mircrodata ?

Or else, is there already some specific codes out there which I can use ?


Thanks !

Please Log in or Create an account to join the conversation.

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
7 years 4 months ago #159452 by Krikor Boghossian
Replied by Krikor Boghossian on topic K2 Rating on Google

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

  • Goble002
  • Goble002's Avatar Topic Author
  • Offline
  • Premium Member
More
7 years 4 months ago #159535 by Goble002
Replied by Goble002 on topic K2 Rating on Google
Hi and thanks,

I read this post before. However some people reported having issues with their codes, I was wondering if you have one that works for sure.

P.S. Am not a PHP coder.

Please Log in or Create an account to join the conversation.

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
7 years 4 months ago #159557 by Krikor Boghossian
Replied by Krikor Boghossian on topic K2 Rating on Google
I have tested the code, it should work fine.
The complaints were that the reviews code should be used, instead.
The rating microdata is however correct.

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

  • Goble002
  • Goble002's Avatar Topic Author
  • Offline
  • Premium Member
More
7 years 4 months ago #159587 by Goble002
Replied by Goble002 on topic K2 Rating on Google
Hello Krikor and thanks,

am not sure what you meant by "the reviews code should be used'. Anyway I have used hereunder but errors with Google 'structured data testing tool' search.google.com/structured-data/testing-tool
<?php if($params->get('itemRating')): ?>
         <div itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating" class="itemRatingBlock"> 
		 <span><?php echo JText::_('K2_RATE_THIS_ITEM'); ?></span>
         	<meta itemprop="worstRating" content="1">
		 	<meta itemprop="bestRating" content="5">
            <meta itemprop="ratingValue" content="<?php echo (($this->item->votingPercentage)/20);?>"/>
        <div class="itemRatingForm">
        	<ul class="itemRatingList">
            	<li class="itemCurrentRating" id="itemCurrentRating<?php echo $this->item->id; ?>" style="width:<?php echo $this->item->votingPercentage; ?>%;">		
                </li>
                <li> <a href="#" rel="<?php echo $this->item->id; ?>" title="<?php echo JText::_('K2_1_STAR_OUT_OF_5'); ?>" class="one-star">1</a> </li>
                <li> <a href="#" rel="<?php echo $this->item->id; ?>" title="<?php echo JText::_('K2_2_STARS_OUT_OF_5'); ?>" class="two-stars">2</a> </li>
                <li> <a href="#" rel="<?php echo $this->item->id; ?>" title="<?php echo JText::_('K2_3_STARS_OUT_OF_5'); ?>" class="three-stars">3</a> </li>
                <li> <a href="#" rel="<?php echo $this->item->id; ?>" title="<?php echo JText::_('K2_4_STARS_OUT_OF_5'); ?>" class="four-stars">4</a> </li>
                <li> <a href="#" rel="<?php echo $this->item->id; ?>" title="<?php echo JText::_('K2_5_STARS_OUT_OF_5'); ?>" class="five-stars">5</a> </li>
            </ul>
        	<div id="itemRatingLog<?php echo $this->item->id; ?>" class="itemRatingLog" <?php echo $this->item->numOfvotes; ?></div>
                <meta itemprop="ratingCount" content="<?php echo (preg_replace('/[^0-9]/', '', $this->item->numOfvotes)); ?>"/>
     	</div>
        </div>
        <?php endif; ?>

Please Log in or Create an account to join the conversation.

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
7 years 4 months ago #159614 by Krikor Boghossian
Replied by Krikor Boghossian on topic K2 Rating on Google
There are different settings for reviews and different for ratings.
Have you posted the code in your site so I can take a look?

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

  • Goble002
  • Goble002's Avatar Topic Author
  • Offline
  • Premium Member
More
7 years 4 months ago #159624 by Goble002
Replied by Goble002 on topic K2 Rating on Google
Hello Krikor and thanks,

got error hereunder when I include them on my website:

Fatal error: Call to a member function get() on null in .../templates/my_template/html/com_k2/item/item.php on line 191

Line 191 starts with:
<?php if($params->get('itemRating')): ?>

Please Log in or Create an account to join the conversation.

  • Goble002
  • Goble002's Avatar Topic Author
  • Offline
  • Premium Member
More
7 years 4 months ago #159726 by Goble002
Replied by Goble002 on topic K2 Rating on Google
Hello,

any update on above ? Thanks !

Please Log in or Create an account to join the conversation.

  • Goble002
  • Goble002's Avatar Topic Author
  • Offline
  • Premium Member
More
7 years 4 months ago #159795 by Goble002
Replied by Goble002 on topic K2 Rating on Google
Hello,

any update on above ? Thanks !

Please Log in or Create an account to join the conversation.

  • Goble002
  • Goble002's Avatar Topic Author
  • Offline
  • Premium Member
More
7 years 4 months ago #159822 by Goble002
Replied by Goble002 on topic K2 Rating on Google
Hi all,

desperately needing to include this in K2, anyone been able to make it work ? Any plugin that exists that would do the job ?

Thanks !

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum