*

Dartimes Tv

  • **
  • 6 posts
Search Console has identified that my site is affected by 1 Product snippet structured data issue(s). The following issues were found on the site.

Top critical issues*
Either "offers", "review", or "aggregate rating" should be specified


*Critical issues prevent this page or feature from appearing in Search results, please how can I fix this issue I have tried to read some similar questions on this forum but none has provided a solution. if the problem is that there is no review on this site then how can I remove the review section to prevent this error or should I set the 5-star rating so that all the pages have reviews

*

MB Themes

Re: Product snippets structured data issues on Google search console
« Reply #1 on: December 09, 2022, 05:00:19 PM »
There is no smart fix until you have rating on all your listings.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

Dartimes Tv

  • **
  • 6 posts
Re: Product snippets structured data issues on Google search console
« Reply #2 on: December 09, 2022, 07:18:15 PM »
ok but my theme isn't showing where my website visitors can rate for a product so what should I do

*

mwindey

  • *****
  • 478 posts
Re: Product snippets structured data issues on Google search console
« Reply #3 on: December 10, 2022, 01:13:46 AM »
The devil can do magic in here....... :-)

Not really the honest way and cheating but it works perfectly. I am doing this about a year or 2 and works for me ...

!important;  First delete in epsilon theme this part in item.php

Code: [Select]
  <!-- 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>


Then: change file within oc-includes/osclass/structured-data.php with this code and and thank me later 8) :o

Code: [Select]
<?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() > 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()->findByPrimaryKeyosc_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": "4.5",
    "bestRating": "5",
    "worstRating": "0",
    "ratingCount": "<?php echo osc_esc_html(osc_user_items_validated()); ?>",
    "reviewCount": "<?php echo osc_esc_html(osc_user_items_validated()); ?>"

  }

  <?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() : __('OSCLASS')); ?>" />
<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');

?>

« Last Edit: December 10, 2022, 01:26:10 PM by mwindey »

*

Dartimes Tv

  • **
  • 6 posts
Re: Product snippets structured data issues on Google search console
« Reply #4 on: December 10, 2022, 02:44:22 AM »
Ok thanks

*

MB Themes

Re: Product snippets structured data issues on Google search console
« Reply #5 on: December 10, 2022, 01:58:03 PM »
@mwindey
You avoided error in validation tool.
After 2 years do you see that you woukd get any benefit out of that?
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

mwindey

  • *****
  • 478 posts
Re: Product snippets structured data issues on Google search console
« Reply #6 on: December 11, 2022, 05:06:39 PM »
@MB Themes

Yes pages without good snippets are not ranked in google... for me it works and with seo score 100%  :)

*

MB Themes

Re: Product snippets structured data issues on Google search console
« Reply #7 on: December 11, 2022, 11:03:10 PM »
yea but still it does not say if it made difference :)
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

mwindey

  • *****
  • 478 posts
Re: Product snippets structured data issues on Google search console
« Reply #8 on: December 12, 2022, 01:46:38 PM »
None  :D :D  :-[ :-[

*

MB Themes

Re: Product snippets structured data issues on Google search console
« Reply #9 on: December 13, 2022, 08:40:23 AM »
 :)
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots