Page 1 of 1

adding microdata

Posted: Tue Apr 02, 2019 1:13 pm
by justahippy
I know where it goes product.tpl and i know the site to link to schema.org but for the life of me i cant get rid of product errors/warnings related to microdata. I am pretty sure i can make it work with html, but i am a php idiot. Below is my section of code for product microdata, can anyone correct it for me or tell me what i need to do? My error is on offers right now with various other optional warnings for other things they request.
<div itemscope itemtype="http://schema.org/Product">
<meta itemprop="name" content="<?php echo $heading_title; ?>" />
<div itemprop="offers" itemscope itemtype="http://schema.org/Offer">
<?php foreach ($_SESSION as $key => $value){$currency = $value['currency'];}?>
<meta itemprop="priceCurrency" content="<?php echo $currency; ?>">
<meta itemprop="price" content="<?php if (!$special) { echo preg_replace('/[^0-9.]+/','',$price);}else{echo preg_replace('/[^0-9.]+/','',$special);} ?>">
<meta itemprop="availability" content="<?php if ($stock >= 1){echo 'In Stock';}else{echo $stock;} ?>">
<meta itemprop="itemCondition" itemtype="http://schema.org/OfferItemCondition" content="http://schema.org/NewCondition" />
</div>
</div>
Thanks for any help!

Re: adding microdata

Posted: Tue Apr 02, 2019 1:22 pm
by ocmta
What are those errors / warnings?

Re: adding microdata

Posted: Tue Apr 02, 2019 2:00 pm
by justahippy
Error
Either "offers", "review", or "aggregateRating" should be specified

Since we do not offer the option of product reviews, we went with offers in the above code.

Warnings : brand, sku, pricevaliduntil, url and product ID

Re: adding microdata

Posted: Tue Apr 02, 2019 3:28 pm
by uksitebuilder
They're just warning on recommended attributes, not required unless you wish to add them in.

Re: adding microdata

Posted: Thu Aug 01, 2019 5:38 pm
by khnaz35
justahippy wrote:
Tue Apr 02, 2019 1:13 pm
I know where it goes product.tpl and i know the site to link to schema.org but for the life of me i cant get rid of product errors/warnings related to microdata. I am pretty sure i can make it work with html, but i am a php idiot. Below is my section of code for product microdata, can anyone correct it for me or tell me what i need to do? My error is on offers right now with various other optional warnings for other things they request.
<div itemscope itemtype="http://schema.org/Product">
<meta itemprop="name" content="<?php echo $heading_title; ?>" />
<div itemprop="offers" itemscope itemtype="http://schema.org/Offer">
<?php foreach ($_SESSION as $key => $value){$currency = $value['currency'];}?>
<meta itemprop="priceCurrency" content="<?php echo $currency; ?>">
<meta itemprop="price" content="<?php if (!$special) { echo preg_replace('/[^0-9.]+/','',$price);}else{echo preg_replace('/[^0-9.]+/','',$special);} ?>">
<meta itemprop="availability" content="<?php if ($stock >= 1){echo 'In Stock';}else{echo $stock;} ?>">
<meta itemprop="itemCondition" itemtype="http://schema.org/OfferItemCondition" content="http://schema.org/NewCondition" />
</div>
</div>
Thanks for any help!

Does this work for you?
I was searching something over the internet and found this code on https://feedarmy.com/kb/adding-microdat ... -merchant/
hopefully will help you.

Code: Select all

<div itemscope itemtype="http://schema.org/Product">
  <meta itemprop="name" content="<?php echo $heading_title; ?>" />
  <div itemprop="offers" itemscope="" itemtype="http://schema.org/Offer">
    <?php foreach ($_SESSION as $key => $value){$currency = $value['currency'];}?>
    <meta itemprop="priceCurrency" content="<?php echo $currency; ?>">
    <meta itemprop="price" content="<?php if (!$special) { echo preg_replace('/[^0-9.]+/','',$price);}else{echo preg_replace('/[^0-9.]+/','',$special);} ?>">
    <meta itemprop="availability" content="<?php if ($stock >= 1){echo 'In Stock';}else{echo $stock;} ?>">
    <meta itemprop="itemCondition" itemtype="http://schema.org/OfferItemCondition" content="http://schema.org/NewCondition" />
  </div>
</div>

Re: adding microdata

Posted: Fri Oct 09, 2020 3:45 am
by ahimanshu
khnaz35 wrote:
Thu Aug 01, 2019 5:38 pm
justahippy wrote:
Tue Apr 02, 2019 1:13 pm
I know where it goes product.tpl and i know the site to link to schema.org but for the life of me i cant get rid of product errors/warnings related to microdata. I am pretty sure i can make it work with html, but i am a php idiot. Below is my section of code for product microdata, can anyone correct it for me or tell me what i need to do? My error is on offers right now with various other optional warnings for other things they request.
<div itemscope itemtype="http://schema.org/Product">
<meta itemprop="name" content="<?php echo $heading_title; ?>" />
<div itemprop="offers" itemscope itemtype="http://schema.org/Offer">
<?php foreach ($_SESSION as $key => $value){$currency = $value['currency'];}?>
<meta itemprop="priceCurrency" content="<?php echo $currency; ?>">
<meta itemprop="price" content="<?php if (!$special) { echo preg_replace('/[^0-9.]+/','',$price);}else{echo preg_replace('/[^0-9.]+/','',$special);} ?>">
<meta itemprop="availability" content="<?php if ($stock >= 1){echo 'In Stock';}else{echo $stock;} ?>">
<meta itemprop="itemCondition" itemtype="http://schema.org/OfferItemCondition" content="http://schema.org/NewCondition" />
</div>
</div>
Thanks for any help!

Does this work for you?
I was searching something over the internet and found this code on https://feedarmy.com/kb/adding-microdat ... -merchant/
hopefully will help you.

Code: Select all

<div itemscope itemtype="http://schema.org/Product">
  <meta itemprop="name" content="<?php echo $heading_title; ?>" />
  <div itemprop="offers" itemscope="" itemtype="http://schema.org/Offer">
    <?php foreach ($_SESSION as $key => $value){$currency = $value['currency'];}?>
    <meta itemprop="priceCurrency" content="<?php echo $currency; ?>">
    <meta itemprop="price" content="<?php if (!$special) { echo preg_replace('/[^0-9.]+/','',$price);}else{echo preg_replace('/[^0-9.]+/','',$special);} ?>">
    <meta itemprop="availability" content="<?php if ($stock >= 1){echo 'In Stock';}else{echo $stock;} ?>">
    <meta itemprop="itemCondition" itemtype="http://schema.org/OfferItemCondition" content="http://schema.org/NewCondition" />
  </div>
</div>
Not work for 3x
Warning Invalid enum value in field "availability"
Invalid price format in property "price"

Re: adding microdata

Posted: Fri Oct 09, 2020 9:56 am
by IP_CAM
Not work for 3x
It does not have to, it's an OC 2 topic here ... :laugh:

Re: adding microdata

Posted: Fri Oct 09, 2020 2:59 pm
by xxvirusxx
ahimanshu wrote:
Fri Oct 09, 2020 3:45 am
Not work for 3x
And is very hard to see the code for 3.x :laugh: :laugh: :laugh: :laugh:
https://feedarmy.com/kb/add-microdata-t ... -shopping/