Problemes amb Schema i Prestashop? Errors a “mansalva” en la prova de dades estructurades?
Ací teniu un codi per copiar i enganxar en el fitxer “product.tpl“. Així i tot, encara poden haver-hi móduls/plugins que donen errades (com el de puntuacions Revi).
{block name='head' append}
<script type="application/ld+json">
{literal}
{
"@context": "https://schema.org/",
"@type": "Product",
"name": "{/literal}{$product.name}{literal}",
"image": "{/literal}{$product.cover.large.url}{literal}",
"description": "{/literal}{$product.description_short|strip_tags:false}{literal}",
"mpn": "{/literal}{$product.reference}{literal}",
"sku": "{/literal}{$product.reference_to_display}{literal}",
"brand": {
"@type": "Brand",
"name": "{/literal}{$product.manufacturer_name}{literal}"
},
{/literal}{if (isset($rating.grade))}{literal}
"aggregateRating": {
"@type": "AggregateRating",
"ratingValue": "{/literal}{$rating.grade}{literal}",
"reviewCount": "{/literal}{$rating.reviewCount}{literal}",
"worstRating": "0",
"bestRating": "5"
},
"review": {
"@type": "Review",
"reviewRating": {
"@type": "Rating",
"ratingValue": "{/literal}{$rating.grade}{literal}",
"bestRating": "5",
"worstRating": "0"
},
"author": {
"@type": "Person",
"name": "Fred Benson"
}
},
{/literal}{/if}{literal}
"offers": {
"@type": "Offer",
"url": "{/literal}{$product.link}{literal}",
"priceCurrency": "{/literal}{$currency.sign}{literal}",
"price": "{/literal}{$product.price_amount}{literal}",
{/literal}{if isset($product.available_for_order)}{literal}
"availability": "https://schema.org/InStock",
{/literal}{else}{literal}
"availability": "https://schema.org/OutOfStock",
{/literal}{/if}{literal}
{/literal}{if isset($product.embedded_attributes.condition) && ($product.embedded_attributes.condition == 'new')}{literal}
"itemCondition": "https://schema.org/NewCondition",
{/literal}{/if}{literal}
{/literal}{if isset($product.embedded_attributes.condition) && ($product.embedded_attributes.condition == 'used')}{literal}
"itemCondition": "https://schema.org/UsedCondition",
{/literal}{/if}{literal}
"priceValidUntil": "{/literal}{$smarty.now|date_format:"%Y"+1}-{$smarty.now|date_format:"%m-%d"}{literal}"
}
}
{/literal}
</script>
{/block}