Keyword

[SOLVED] How to get ratingValue for Google Microdata

More
8 years 7 months ago #148219 by NormanBLN
Hi Krikor,
do had news for us?

Greetings
Norman

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

More
8 years 6 months ago #148479 by NormanBLN
Hi Krikor,

don't let us not so long wait ..

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
8 years 6 months ago #148493 by Krikor Boghossian
Replied by Krikor Boghossian on topic [SOLVED] How to get ratingValue for Google Microdata
Sorry about that,
The code provided by Roman is actually correct: schema.org/AggregateRating

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 5 months ago #149677 by NormanBLN
hi Kirkor,

I think I need your help.
We try to integrate the code from @Lipatov but this don't work. We replace the code in our item (ourtemplate/html/com_k2/default). This don't work. I was looking for a file with this new code on github (github.com/joomlaworks/k2) but nothing.

I hope you can help us.
<?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; ?>

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 5 months ago #149683 by Krikor Boghossian
Replied by Krikor Boghossian on topic [SOLVED] How to get ratingValue for Google Microdata
If you are using more than one K2 subtemplates this post will help you figure which template to edit: www.joomlaworks.net/blog/item/194-k2-inheritance-sub-templating

If on the other hand you followed the instructions as stated here: getk2.org/documentation/tutorials/174-templating-with-k2-and-the-concepts-of-sub-templates and the edits are not shown, then an extension or a template framework is 'blocking' the default process of overrides.

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 5 months ago #149691 by NormanBLN
Hi Krikor,

thanks but I know that. I was trying that way. My problem is the correct poistion from the code because if I try that - the template is broken.
I set Lipatov's code instead of the original k2 code and that not work.

Can you give me more details for a work file. Or, you worte on september you will give a working file to github. This is a option to help all of us to fix the rating.

Greetings

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
8 years 5 months ago #149693 by Krikor Boghossian
Replied by Krikor Boghossian on topic [SOLVED] How to get ratingValue for Google Microdata
I see an extra closing </div> tag.
Other than that the structured data code is correct, there is no need for an edit or a new file.

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

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

More
7 years 8 months ago #157307 by NormanBLN
Hi Krikor,
we found the problem and fix it. Since same month it works fine. Now, we have the problem with the <?php echo $this->item->numOfvotes; ?></div> . The result is: <meta itemprop="ratingCount" content="9Stimmen">. "Stimmen" means votes and google like to have only the number.

Here is the result from the structured-data testing tool: search.google.com/structured-data/testing-tool#url=https%3A%2F%2Foffensichtlich.de%2Fblog%2Ftour-de-france-mit-rudy-project

Do you had a idea for us?

Greetings & Thx

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
7 years 8 months ago #157327 by Krikor Boghossian
Replied by Krikor Boghossian on topic [SOLVED] How to get ratingValue for Google Microdata
Sure,
You can use str_replace php.net/manual/en/function.str-replace.php in order to manipulate the language string.

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