How to handle Reviews Rich Snippets with my theme ?
With this FAQ we will help you to handle detail Reviews Rich snippets with your shop.By default Prestashop doesn't handle this data, that why the FAQ is for technical person ( you will have to modify some code ).
And you need our module version 5.0.3+, or it won't work.
All modification have to be done on hemes/your_theme/templates/_partials/microdata/product-jsonld.tpl, and do NOT forget backup original file, to rollback if you make a mistake.
Step 1
Replace code below
{if !empty($product.productComments.averageRating) && !empty($product.productComments.nbComments)} {assign var=hasAggregateRating value=true} {assign var=ratingValue value=$product.productComments.averageRating} {assign var=ratingReviewCount value=$product.productComments.nbComments} {/if}by
{if !empty($product.productComments.averageRating) && !empty($product.productComments.nbComments)} {assign var=hasAggregateRating value=true} {assign var=ratingValue value=$product.productComments.averageRating} {assign var=ratingReviewCount value=$product.productComments.nbComments} {assign var=reviews value=$product.productComments.reviews} {/if}We just add
{assign var=reviews value=$product.productComments.reviews}Step 2
Replace the code below
{if $hasAggregateRating}, "aggregateRating": { "@type": "AggregateRating", "ratingValue": "{$ratingValue|round:1|escape:'html':'UTF-8'}", "reviewCount": "{$ratingReviewCount|escape:'html':'UTF-8'}" }by
{/if}
{if $hasAggregateRating}, "aggregateRating": { "@type": "AggregateRating", "ratingValue": "{$ratingValue|round:1|escape:'html':'UTF-8'}", "reviewCount": "{$ratingReviewCount|escape:'html':'UTF-8'}" } {if $reviews} , "review": [ {foreach from=$reviews item=comment} {if $comment.content} { "@type": "Review", "author": { "@type": "Person", "name": "{$comment.customer_name|escape:'html':'UTF-8'}" }, "datePublished": "{$comment.date_add|escape:'html':'UTF-8'|substr:0:10}", "reviewRating": { "@type": "Rating", "description": "{$comment.content|nl2br nofilter}", "ratingValue": "{$comment.grade|escape:'html':'UTF-8'}", "bestRating": "5", "worstRating": "1" } {if $comment@last} } {else} }, {/if} {/if} {/foreach} ] {/if} {/if}