Support forums > Tips, tricks, and tutorials
How to add structured data / schema / star rating to an OSclass powered website
(1/1)
keslar:
I won't go into the details of the benefits of structured data / schema markup. If you want to succeed in SEO then you need all the help you can get / ranking factors in your favor, structured data being one.
This tutorial is tested and confirmed using Google's Structured Data testing tool and is what I use on my website 360occasions
First, you need to install the OSclass rating plugin at https://market.osclass.org/plugins/reviews-ratings/rating_35
after that, from your File manager in cpanel, navigate to oc-content/plugins/voting/
Edit view_votes.php and add the following code at the bottom then save
--- Code: --- <script type="application/ld+json">
{ "@context": "http://schema.org",
"@type": "Service",
"name": "<?php echo osc_item_title(); ?>",
"areaServed": "<?php echo osc_item_city().", ".osc_item_country(); ?>",
"provider": "<?php echo osc_item_contact_name(); ?>",
"description": "<?php echo osc_item_description();?>"
<?php if ($vote['total']>1) {?>,
"aggregateRating":
{"@type": "AggregateRating",
"bestRating": "5",
"worstRating": "1",
"ratingValue": "<?php echo $vote['vote'];?>",
"reviewCount": "<?php echo $vote['total'];?>"
}
<?php } ?>
}
</script>
--- End code ---
omid_firoznia:
Thanks, Thats work.
But in "Product" it does not work !
is there any way to make it work in "product" too?
{there is 7 warning in "product" one of theme is about aggregateRating and it say:
The aggregateRating field is recommended. Please provide a value if available.
Navigation
[0] Message Index
Go to full version