Keyword

[SOLVED] How to get ratingValue for Google Microdata

  • Roman Lipatov
  • Roman  Lipatov's Avatar Topic Author
  • Offline
  • New Member
More
8 years 8 months ago - 8 years 8 months ago #146644 by Roman Lipatov
Hi!
I trying to configure Ratings stars for Google Microdata

I can't understand, hot to get ratingValue

This is code with already working parameters:

aggregateRating [AggregateRating]:
worstRating:
bestRating:
ratingCount:

But without ratingValue
<?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">
                              
                                        <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; ?>

Thanks!
Last edit: 8 years 8 months ago by Roman Lipatov.

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

  • Roman Lipatov
  • Roman  Lipatov's Avatar Topic Author
  • Offline
  • New Member
More
8 years 8 months ago - 8 years 8 months ago #146646 by Roman Lipatov
Replied by Roman Lipatov on topic How to get ratingValue for Google Microdata
Ok, I got it
<meta itemprop="ratingValue" content="<?php echo (($this->item->votingPercentage)/20);?>"/>
Last edit: 8 years 8 months ago by Roman Lipatov.

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
8 years 8 months ago #146670 by Krikor Boghossian
Replied by Krikor Boghossian on topic How to get ratingValue for Google Microdata
You are correct Roman, this is the correct value.

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

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

More
8 years 7 months ago - 8 years 7 months ago #146970 by German Levi
<div class="mdf" itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating">
    <div>Rating
      <?php $rating_value = $this->item->votingPercentage; ?>
      <?php 
      $pattern = array("(",")"," ","Голосовать","голосов");
      $rating_count = str_replace($pattern,"",$this->item->numOfvotes); 
      ?>
      <span itemprop="ratingValue"><?php echo $rating_value * 0.05; ?></span> из 
      <span itemprop="bestRating">5</span> Голосов:
      <span itemprop="ratingCount"><?php echo $rating_count; ?></span>
    </div>
  </div>
Last edit: 8 years 7 months ago by German Levi.

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

More
8 years 7 months ago - 8 years 7 months ago #147642 by NormanBLN
Hello Roman, Hello Krikor,
we the same goal for our website. In former times we use the plugin rich snipped vote but since google change the required data this don't work :(

Works this rating now and shows in the search results? With the Structured Data Testing Tool I can't find the [AggregateRating] informations?
The new required data you can find here: developers.google.com/structured-data/rich-snippets/reviews

Do you had a idea to integrate the missing data.
Hey Kirkor Is it a idea to open a github file and so give a fix for all k2 user?

Greetings
Norman
Last edit: 8 years 7 months ago by NormanBLN.

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
8 years 7 months ago #147653 by Krikor Boghossian
Replied by Krikor Boghossian on topic [SOLVED] How to get ratingValue for Google Microdata
Hello Norman,

Thank you for letting us know.
K2 is already on github github.com/joomlaworks/k2 but I think this is better suited for a gist.

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

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

More
8 years 7 months ago #147700 by NormanBLN
Hello Krikor,

thanks for your answer. I saw this, K2 on grithub, the last time as it gave the probleme with the new update from joomlaand "item must have a title" popup.

Okay - give it a project to integrate the ratingValue for Google? If yes, where I can find this? Give it a plan to integrate that in a k2 update?
I think it's the best way if we create/received the nessary data by k2 as if use another plugins.

Greetings
Norman

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
8 years 7 months ago #147742 by Krikor Boghossian
Replied by Krikor Boghossian on topic [SOLVED] How to get ratingValue for Google Microdata
The first issue has been solved. Please read:
www.joomlaworks.net/forum/k2-en/42883-item-must-have-a-title-pops-up-after-upgrade-joomla-3-4-4?start=10

As for the microdata I' ll publish something on Github.

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

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

More
8 years 7 months ago #147749 by NormanBLN
Hi Krikor,

thanks for your answer. The first point - I know. I found the here in the forum an JCE published a fix for the editor. :-)

And for two - it is a good Idea :-) Thanks a lot.

Greetings Norman

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
8 years 7 months ago #147779 by Krikor Boghossian
Replied by Krikor Boghossian on topic [SOLVED] How to get ratingValue for Google Microdata
I 'll post my gist here Norman :)

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

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


Powered by Kunena Forum