From 8bc37961f507c4912ace935dee9f752c0f1ca9a9 Mon Sep 17 00:00:00 2001 From: rodriciru Date: Thu, 9 Jun 2022 16:47:31 +0200 Subject: [PATCH] Add products reviews to schema.org --- .../_partials/microdata/product-jsonld.tpl | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/templates/_partials/microdata/product-jsonld.tpl b/templates/_partials/microdata/product-jsonld.tpl index 113ebf078..33c7a60ee 100644 --- a/templates/_partials/microdata/product-jsonld.tpl +++ b/templates/_partials/microdata/product-jsonld.tpl @@ -17,6 +17,26 @@ "@type": "Brand", "name": "{if $product_manufacturer->name}{$product_manufacturer->name|escape:'html':'UTF-8'}{else}{$shop.name}{/if}" },{/if} + {if !empty($product.productComments.comments)} + "review": [ + {foreach from=$product.productComments.comments item=comment} + { + "@type": "Review", + "reviewRating": { + "@type": "Rating", + "ratingValue": "{$comment.grade}", + "datePublished": "{$comment.date_add}" + }, + "name": "{$comment.title}", + "author": { + "@type": "Person", + "name": "{$comment.customer_name}" + }, + "reviewBody": "{$comment.content}" + } + {/foreach} + ], + {/if} {if isset($nbComments) && $nbComments && $ratings.avg}"aggregateRating": { "@type": "AggregateRating", "ratingValue": "{$ratings.avg|round:1|escape:'html':'UTF-8'}",