Skip to content

Instantly share code, notes, and snippets.

@caovillanueva
Last active October 7, 2021 18:01
Show Gist options
  • Save caovillanueva/72fbd929d91d17e7037ce154c000f453 to your computer and use it in GitHub Desktop.
Save caovillanueva/72fbd929d91d17e7037ce154c000f453 to your computer and use it in GitHub Desktop.
[PS1.6 Rich Snippets Google SEO] Microdata. More information: https://developers.google.com/search/docs/advanced/structured-data/product#microdata #PS16 #SEO
1. Only 1 tag of product shoulb be exist.
<p class="our_price_display" itemprop="offers" itemscope itemtype="https://schema.org/Offer">
<meta itemprop="priceValidUntil" content="{'Y'|date}-12-31" />
<meta itemprop="url" content="{$link->getProductLink($product)}">
</p>
<div itemprop="brand" itemscope itemtype="http://schema.org/Brand">
<meta itemprop="name" content="{$product_manufacturer->name}">
</div>
{if !empty($product->reference) && $product->reference}
<meta itemprop="mpn" content="{$product->reference}" /> <!-- If not have mpn, use the reference val. -->
{/if}
#######IF THE CODE CAME FROM ANY MODULE THAT NOT HAVE TAGS:
<meta itemprop="availability" content="{$priceDisplay}" />
<!-- Put out of Offer block. -->
<meta itemprop="brand" content="{$product.manufacturer_name}" />
<meta itemprop="sku" content="{$product.reference}" />
{if !empty($product.reference) && $product.reference}
<meta itemprop="mpn" content="{$product.reference}" />
{/if}
<meta itemprop="description" content="{$product.description|strip_tags}" />
FOR PRESTASHOP 1.6.XX
<meta itemprop="brand" content="{$product->manufacturer_name}" />
<meta itemprop="description" content="{$product->description|strip_tags}" />
Warning "ratingValue" when no reviews in product.
Just ommit aggregate Rarting
themes/cellular/modules/productcomments
FOR PRESTASHOP 1.6.XX
Before:
<div id="product_comments_block_extra" class="no-print col-sm-5" itemprop="aggregateRating" itemscope itemtype="https://schema.org/AggregateRating">
After:
<div id="product_comments_block_extra" class="no-print col-sm-5" {if $nbComments != 0} itemprop="aggregateRating" itemscope itemtype="https://schema.org/AggregateRating"{/if}>
Add this one if apply,avoid "One of ratingCount or reviewCount must be provided.":
<meta itemprop="reviewCount" content = "{$nbComments}" />
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment