Osclass Support Forums
Osclass plugin support => Seo Plugins => Topic started by: bemtele on June 10, 2022, 12:29:37 PM
-
Google search console gives errors related to products. It says:
Either "offers", "review", or "aggregateRating" should be specified
Please how do I solve this issue?
-
@bemtele
Do you have ratings or reviews on your listings?
-
@bemtele
Do you have ratings or reviews on your listings?
Do you mean: User Rating Plugin: https://osclasspoint.com/osclass-plugins/rating-and-review/user-rating-plugin-i57
If so then I don't have. Is that the problem here? I understand this plugin is to rate users but google is asking for product reviews.
Or does it relate? I kinda don't have an idea about this.
-
@bemtele
I am just asking. If no, then it is completely irrelevant to even think about setting any value. Google simple expects something here but if your site does not use rating then this warning should stay there.
-
@bemtele
I am just asking. If no, then it is completely irrelevant to even think about setting any value. Google simple expects something here but if your site does not use rating then this warning should stay there.
Alright!, I was following some SEO tips and the blogger suggest to correct any error in search console because some may be impacting website SEO. I decided to check and I got that error but if it will not have any impact on my site SEO then I am cool with that.
Thank you
-
Yes but this one is tricky and looks like fail from google.
-
I fixed this problem myself, I can help you. What theme do you have installed?
-
I fixed this problem myself, I can help you. What theme do you have installed?
I am using Epsilon theme
-
In the item_php file, find the lines
<!-- GOOGLE RICH SNIPPETS -->
<span itemscope itemtype="http://schema.org/Product">
<meta itemprop="name" content="<?php echo osc_esc_html(osc_item_title()); ?>" />
<meta itemprop="description" content="<?php echo osc_esc_html(osc_highlight(osc_item_description(), 500)); ?>" />
<?php if(osc_count_item_resources() > 0) { ?><meta itemprop="image" content="<?php echo $resource_url; ?>" /><?php } ?>
</span>
replaced by
<!-- GOOGLE RICH SNIPPETS -->
<div style="display: none" itemscope itemtype="http://schema.org/Product">
<meta itemprop="name" content="<?php echo osc_esc_html(osc_item_title()); ?>" />
<meta itemprop="description" content="<?php echo osc_esc_html(osc_highlight(osc_item_description(), 500)); ?>" />
<?php if(osc_count_item_resources() > 0) { ?>
<meta itemprop="image" content="<?php echo osc_resource_url(); ?>" /><?php } ?>
<span itemprop="offers" itemscope itemtype="http://schema.org/Offer">
<meta itemprop="price" content="<?php echo osc_item_price()/1000000; ?>" /><?php if(osc_item_price() <> '' and osc_item_price() <> 0) { ?>
<meta itemprop="priceCurrency" content="<?php echo osc_item_currency(); ?>" /><?php } ?>
<meta itemprop="priceValidUntil" content=" <?php echo (date('Y', strtotime(osc_item_field('dt_expiration'))) > 3000 ? __('Never expire', 'epsilon') : __('Expire on', 'epsilon') . ' ' . date('d/m/Y', strtotime(osc_item_field('dt_expiration')))); ?> ">
<meta itemprop="url" content="<?php echo osc_item_url(); ?>">
<link itemprop="availability" href="http://schema.org/InStock" />
</span>
</div>
-
In the item_php file, find the lines
<!-- GOOGLE RICH SNIPPETS -->
<span itemscope itemtype="http://schema.org/Product">
<meta itemprop="name" content="<?php echo osc_esc_html(osc_item_title()); ?>" />
<meta itemprop="description" content="<?php echo osc_esc_html(osc_highlight(osc_item_description(), 500)); ?>" />
<?php if(osc_count_item_resources() > 0) { ?><meta itemprop="image" content="<?php echo $resource_url; ?>" /><?php } ?>
</span>
replaced by
<!-- GOOGLE RICH SNIPPETS -->
<div style="display: none" itemscope itemtype="http://schema.org/Product">
<meta itemprop="name" content="<?php echo osc_esc_html(osc_item_title()); ?>" />
<meta itemprop="description" content="<?php echo osc_esc_html(osc_highlight(osc_item_description(), 500)); ?>" />
<?php if(osc_count_item_resources() > 0) { ?>
<meta itemprop="image" content="<?php echo osc_resource_url(); ?>" /><?php } ?>
<span itemprop="offers" itemscope itemtype="http://schema.org/Offer">
<meta itemprop="price" content="<?php echo osc_item_price()/1000000; ?>" /><?php if(osc_item_price() <> '' and osc_item_price() <> 0) { ?>
<meta itemprop="priceCurrency" content="<?php echo osc_item_currency(); ?>" /><?php } ?>
<meta itemprop="priceValidUntil" content=" <?php echo (date('Y', strtotime(osc_item_field('dt_expiration'))) > 3000 ? __('Never expire', 'epsilon') : __('Expire on', 'epsilon') . ' ' . date('d/m/Y', strtotime(osc_item_field('dt_expiration')))); ?> ">
<meta itemprop="url" content="<?php echo osc_item_url(); ?>">
<link itemprop="availability" href="http://schema.org/InStock" />
</span>
</div>
Thank you. I am trying now. I will give feedback after that
-
In the item_php file, find the lines
<!-- GOOGLE RICH SNIPPETS -->
<span itemscope itemtype="http://schema.org/Product">
<meta itemprop="name" content="<?php echo osc_esc_html(osc_item_title()); ?>" />
<meta itemprop="description" content="<?php echo osc_esc_html(osc_highlight(osc_item_description(), 500)); ?>" />
<?php if(osc_count_item_resources() > 0) { ?><meta itemprop="image" content="<?php echo $resource_url; ?>" /><?php } ?>
</span>
replaced by
<!-- GOOGLE RICH SNIPPETS -->
<div style="display: none" itemscope itemtype="http://schema.org/Product">
<meta itemprop="name" content="<?php echo osc_esc_html(osc_item_title()); ?>" />
<meta itemprop="description" content="<?php echo osc_esc_html(osc_highlight(osc_item_description(), 500)); ?>" />
<?php if(osc_count_item_resources() > 0) { ?>
<meta itemprop="image" content="<?php echo osc_resource_url(); ?>" /><?php } ?>
<span itemprop="offers" itemscope itemtype="http://schema.org/Offer">
<meta itemprop="price" content="<?php echo osc_item_price()/1000000; ?>" /><?php if(osc_item_price() <> '' and osc_item_price() <> 0) { ?>
<meta itemprop="priceCurrency" content="<?php echo osc_item_currency(); ?>" /><?php } ?>
<meta itemprop="priceValidUntil" content=" <?php echo (date('Y', strtotime(osc_item_field('dt_expiration'))) > 3000 ? __('Never expire', 'epsilon') : __('Expire on', 'epsilon') . ' ' . date('d/m/Y', strtotime(osc_item_field('dt_expiration')))); ?> ">
<meta itemprop="url" content="<?php echo osc_item_url(); ?>">
<link itemprop="availability" href="http://schema.org/InStock" />
</span>
</div>
Also, can you check this topic for me: https://forums.osclasspoint.com/osclass/google-say-submitted-url-marked-noindex/
Even though MB-Themes has replied to me, I still need a second opinion as to why google says my search page can't be indexed and that it is marked as "noindex" . Is it normal? is your website search page (https://domain.com/search) marked as "noindex" according to google?
I just want to be sure Google is in Love with my website by fixing any shortcomings in the console. I hope you understand me
-
This doesn't work at all.... Solution is way more complicated than just wright extra tags in item.php....
You get duplicated content and even more errors in Google by adding more snippets in more places.
The solution is to delete google snippets in item.php completely and focus on file structured data which is in oc-includes....
-
This doesn't work at all.... Solution is way more complicated than just wright extra tags in item.php....
You get duplicated content and even more errors in Google by adding more snippets in more places.
The solution is to delete google snippets in item.php completely and focus on file structured data which is in oc-includes....
Can you kindly provide a step-by-step approach to this problem? especially the file structured data you mentioned in the oc-includes?
-
Took me a full day off work to find this out ::)
File is in oc-includes but tricky because some snippets are normally not there but i gave them a function just so that the do not give warnings anymore....
Look at the file and give it a try yourself...If you play with some you will get there :P
-
This is my full structured data file so far....Needs still some improvement regarding aggregate rating but works so far perfect for now in google.
Ratingvalue is set to 3 stars because not all things on your site can have a five :D :D
Copy, paste and test some links in search console ;) 8) ....
Remember to delete all Google snippets in item.php or you will have duplicates.
Note: I will only leave my hard work here untill my mind decides to delete it 8) 8)
<?php
/*
* Copyright 2014 Osclass
* Copyright 2021 Osclass by OsclassPoint.com
*
* Osclass maintained & developed by OsclassPoint.com
* You may not use this file except in compliance with the License.
* You may download copy of Osclass at
*
* https://osclass-classifieds.com/download
*
* Do not edit or add to this file if you wish to upgrade Osclass to newer
* versions in the future. Software is distributed on an "AS IS" basis, without
* warranties or conditions of any kind, either express or implied. Do not remove
* this NOTICE section as it contains license information and copyrights.
*/
function osc_structured_data_title() {
$text = meta_title();
return osc_apply_filter('structured_data_title_filter', $text);
}
function osc_structured_data_description() {
$text = meta_description();
return osc_apply_filter('structured_data_description_filter', $text);
}
function osc_structured_data_image() {
$logo_url = '';
$logo = osc_get_preference('logo', osc_current_web_theme());
if($logo != '' && file_exists(osc_uploads_path() . $logo)) {
$path = str_replace(ABS_PATH, '', osc_uploads_path());
$logo_url = osc_base_url() . $path . $logo;
} else if (file_exists(osc_base_path() . 'oc-content/themes/' . osc_current_web_theme() . '/images/logo.jpg')) {
$logo_url = osc_base_url() . 'oc-content/themes/' . osc_current_web_theme() . '/images/logo.jpg';
} else if (file_exists(osc_base_path() . 'oc-content/themes/' . osc_current_web_theme() . '/images/logo.png')) {
$logo_url = osc_base_url() . 'oc-content/themes/' . osc_current_web_theme() . '/images/logo.png';
} else if (file_exists(osc_base_path() . 'oc-content/themes/' . osc_current_web_theme() . '/images/logo.gif')) {
$logo_url = osc_base_url() . 'oc-content/themes/' . osc_current_web_theme() . '/images/logo.gif';
}
$url = $logo_url;
if(osc_is_ad_page()) {
if(osc_count_item_resources() > 0) {
$url = osc_resource_url();
}
}
return osc_apply_filter('structured_data_image_filter', $url);
}
function osc_structured_data_footer() {
if(osc_structured_data_enabled()) {
$url = osc_get_current_url();
$image_url = osc_structured_data_image();
if(osc_is_ad_page()) {
$url = osc_item_url();
$location = array(osc_item_country(), osc_item_region(), osc_item_city(), osc_item_address());
$location = implode(', ', array_filter($location));
}
$url = osc_apply_filter('structured_data_url_filter', $url);
if(osc_is_ad_page()) {
?>
<script type="application/ld+json">
{
"@context": "https://schema.org/",
"@type": "Product",
"name": "<?php echo osc_esc_html(osc_item_title()); ?>",
<?php if($image_url <> '') { ?>"image": "<?php echo osc_esc_html($image_url); ?>",<?php echo PHP_EOL; } ?>
"description": "<?php echo osc_esc_html(osc_highlight(osc_item_description(), 500)); ?>",
"sku" : "<?php echo osc_esc_html(osc_total_items()); ?>",
"isbn" : "<?php echo osc_esc_html(osc_item_user_id()); ?>",
"offers": {
"@type": "Offer",
"itemOffered": "<?php echo osc_esc_html(osc_item_title()); ?>",
"url": "<?php echo osc_esc_html($url); ?>",
<?php if(osc_item_price() > 0) { ?>"priceCurrency": "<?php echo osc_esc_html(osc_item_currency()); ?>",<?php echo PHP_EOL; } ?>
"price": "<?php echo osc_esc_html(osc_item_price() > 0 ? osc_item_price() : 0); ?>",
"priceValidUntil": "<?php echo date('d-m-Y', strtotime(osc_item_field('dt_pub_date') . ' + 365 days')); ?>",
"availability": "https://schema.org/InStock"
},
"category": {
"@type": "Category",
"offer": "<?php echo osc_esc_html(osc_item_category($locale = “”)); ?>"
},
"brand": {
"@type": "Brand",
"brand": "<?php $user = User::newInstance()->findByPrimaryKey( osc_item_user_id() ); ?>
<?php if($user['b_company'] == 1) { ?>
<?php _e('Company'); ?>
<?php } else { ?>
<?php _e('Private seller'); ?>
<?php } ?>"
},
"seller": {
"@type": "Seller",
"seller": "<?php echo osc_esc_html(osc_user_name()); ?>"
},
"aggregateRating": {
"@type": "AggregateRating",
"ratingValue": "3",
"bestRating": "5",
"worstRating": "0",
"ratingCount": "6",
"reviewCount": "6"
}
<?php osc_run_hook('structured_data_footer'); ?>
}
</script>
<?php } else { ?>
<script type="application/ld+json">
{
"@context": "http://schema.org/",
"@type": "Organization",
<?php if($image_url <> '') { ?>"logo": "<?php echo osc_esc_html($image_url); ?>",<?php echo PHP_EOL; } ?>
"name": "<?php echo osc_esc_html(osc_item_title); ?>",
"url": "<?php echo osc_esc_html($url); ?>"
<?php osc_run_hook('structured_data_footer'); ?>
}
</script>
<?php
}
}
}
osc_add_hook('footer', 'osc_structured_data_footer');
function osc_structured_data_header() {
if(osc_structured_data_enabled()) {
$url = osc_get_current_url();
$image_url = osc_structured_data_image();
if(osc_is_ad_page()) {
$url = osc_item_url();
$location = array(osc_item_country(), osc_item_region(), osc_item_city(), osc_item_address());
$location = implode(', ', array_filter($location));
}
?>
<!-- Facebook Open Graph Tags-->
<meta property="og:title" content="<?php echo osc_esc_html(osc_structured_data_title()); ?>" />
<meta property="og:site_name" content="<?php echo osc_esc_html(osc_structured_data_title()); ?>"/>
<meta property="og:url" content="<?php echo osc_esc_html($url); ?>" />
<meta property="og:description" content="<?php echo osc_esc_html(osc_highlight(osc_structured_data_description(), 200)); ?>" />
<meta property="og:locale" content="<?php echo osc_esc_html(osc_current_user_locale()); ?>" />
<meta property="og:image" content="<?php echo $image_url; ?>" />
<?php if(osc_is_ad_page()) { ?>
<?php if($location <> '') { ?><meta property="og:place" content="<?php echo osc_esc_html($location); ?>" /><?php echo PHP_EOL; } ?>
<meta property="og:type" content="product" />
<meta property="product:availability" content="<?php echo __('Available'); ?>" />
<meta property="product:retailer_item_id" content="<?php echo osc_esc_html(osc_item_id()); ?>" />
<?php if(osc_item_price() > 0) { ?><meta property="product:price:amount" content="<?php echo osc_esc_html(osc_item_price()); ?>" /><?php echo PHP_EOL; } ?>
<?php if(osc_item_price() > 0) { ?><meta property="product:price:currency" content="<?php echo osc_esc_html(osc_item_currency()); ?>" /><?php echo PHP_EOL; } ?>
<?php } ?>
<!-- Twitter Tags-->
<meta name="twitter:card" content="summary" />
<meta name="twitter:site" content="@<?php echo osc_esc_html(osc_item_contact_name() <> '' ? osc_item_contact_name() : __('Anonymous')); ?>" />
<meta name="twitter:title" content="<?php echo osc_esc_html(osc_structured_data_title()); ?>" />
<meta name="twitter:description" content="<?php echo osc_esc_html(osc_highlight(osc_structured_data_description(), 200)); ?>" />
<meta name="twitter:image" content="<?php echo osc_esc_html($image_url); ?>" />
<?php osc_run_hook('structured_data_header'); ?>
<?php
}
}
osc_add_hook('header', 'osc_structured_data_header');
?>
Thank you very much. I moved my site to VPS, and everything has been messed up, including Email sending. So I am solving it. After that, I will test your structured data code and give feedback here. Once again thank you so much.
-
Why do you think it doesn't work? I registered what Google requires and as it recommends. The task is to make it clear to Google that this is a product, how much money it costs, what currency and publication period. He does not require anything else. And you in your code indicated the rating of which does not exist!
-
@vlad7
When i used the snippets you provided i was getting errors in console not warnings. Probably because i also use rating plugin and the meta generator plugin.
The file structured data creates aggregating snippets as standard but it uses the comments... Since only some people use the comments it will show no rating in google and for me personally, if there is 5 star in my search on google results i would visit that site first...
There is also no need to use extra snippets in themes because the file was there already so why invent the wheel twice.
Originally in structured data there is:
"aggregateRating": {
"@type": "AggregateRating",
"ratingValue": "<?php echo round(osc_count_item_comments_rating(), 1); ?>",
"bestRating": "5",
"worstRating": "0",
"ratingCount": "<?php echo (osc_count_item_comments() > 0 ? osc_count_item_comments() : 1); ?>",
"reviewCount": "<?php echo (osc_count_item_comments() > 0 ? osc_count_item_comments() : 1); ?>"
}
<?php osc_run_hook('structured_data_footer'); ?>
}
</script>
-
@vlad7
When i used the snippets you provided i was getting errors in console not warnings. Probably because i also use rating plugin and the meta generator plugin.
The file structured data creates aggregating snippets as standard but it uses the comments... Since only some people use the comments it will show no rating in google and for me personally, if there is 5 star in my search on google results i would visit that site first...
There is also no need to use extra snippets in themes because the file was there already so why invent the wheel twice.
Originally in structured data there is:
"aggregateRating": {
"@type": "AggregateRating",
"ratingValue": "<?php echo round(osc_count_item_comments_rating(), 1); ?>",
"bestRating": "5",
"worstRating": "0",
"ratingCount": "<?php echo (osc_count_item_comments() > 0 ? osc_count_item_comments() : 1); ?>",
"reviewCount": "<?php echo (osc_count_item_comments() > 0 ? osc_count_item_comments() : 1); ?>"
}
<?php osc_run_hook('structured_data_footer'); ?>
}
</script>
I tried the structured data solution but I got an error in the search console:
-
i also got the same error Either "offers", "review", or "aggregateRating" should be specified on my google search console what is the solution for this is their away to remove the product ratings
-
Do you have reviews for your listings?
-
Finally I solved all errors here - https://bestclassifiedsusa.com (https://bestclassifiedsusa.com)