En effet, $ID étant vide, je l'ai remplacé par $product_id.
Bon j'ai bien avancé, je pense être ok mais ne pas hésiter à me corriger. Si jamais le code est bon, il pourra peut être servir à quelqu'un, c'est un peu chiant les données structurées.
Mon fichier ajax-comments.html me semble correct.
Le seul truc que je n'arrive toujours pas à faire, c'est le comptage correct des avis dans le fichier product.html
J'ai essayé de modifier le count de plein de manières sans succès, je vais laisser mon cerveau refroidir ...
Dans product.html :
{$rating={meta meta="COMMENT_RATING" key="product" id="$product_id"}}
{if $rating}
<div itemprop="aggregateRating" itemtype="http://schema.org/AggregateRating" itemscope>
<meta itemprop="reviewCount" content="{count type="comment" ref="{$ref}" ref_id="{$ref_id}" id="{$product_id}" status="1" }" />
<meta itemprop="ratingValue" content="{$rating}" />
<meta itemprop="itemreviewed" content="{$TITLE}"/>
</div>
<div itemprop="review" itemtype="http://schema.org/Review" itemscope>
<div itemprop="author" itemtype="http://schema.org/Person" itemscope>
<meta itemprop="name" content="{$username}" />
<meta itemprop="ratingValue" content="{$rating}" />
</div>
<div itemprop="reviewRating" itemtype="http://schema.org/Rating" itemscope>
<meta itemprop="ratingValue" content="{$rating}" />
<meta itemprop="bestRating" content="5" />
</div>
{/if}
Le fichier ajax-comments.html
{$locale={lang attr="locale"}}
{$customer_id={customer attr="id"}}
{$rating2={meta meta="COMMENT_RATING" key="product" id="$ref_id"}}
<div itemprop="aggregateRating" itemtype="http://schema.org/AggregateRating" itemscope>
<meta itemprop="reviewCount" content="{count type="comment" ref="{$ref}" ref_id="{$ref_id}" id="{$PRODUCT_ID}" status="1" }" />
<meta itemprop="ratingValue" content="{$rating2}" />
<meta itemprop="itemreviewed" content="{$TITLE}"/>
</div>
{ifloop rel="comments"}
{function name=comment_stars empty=1}
{$star='<span class="glyphicon glyphicon-star"></span>'}
{$star_empty='<span class="glyphicon glyphicon-star-empty"></span>'}
{for $foo=0 to 4}
{if $value > $foo}
{$star nofilter}
{elseif $empty == 1}
{$star_empty nofilter}
{/if}
{/for}
{/function}
{loop name="comments" type="comment" ref="{$ref}" ref_id="{$ref_id}" status="1" order="created_reverse"
offset="{$start}" limit="{$count}" }
{if $CUSTOMER_ID}
{loop name="customer" type="customer" id="{$CUSTOMER_ID}" current="false" limit="1"}
{$username="{$FIRSTNAME} {$LASTNAME|truncate:2:"...":false}"}
{$image="http://www.gravatar.com/avatar/{$EMAIL|trim|strtolower|md5}?d=mm&s=64"}
{/loop}
{elseloop rel="customer"}
{$username={intl d="comment.fo.default" l="Anonymous"} }
{$image={image file='assets/img/avatar.png'}}
{/elseloop}
{else}
{$username=$USERNAME}
{$image="http://www.gravatar.com/avatar/{$EMAIL|trim|strtolower|md5}?d=mm&s=64"}
{/if}
<div id="comment-customer-{counter}" class="comment-item media">
<div itemprop="review" itemscope itemtype="http://schema.org/Review">
<meta itemprop="author" content="{$username}" />
<img src="{$image}" alt="" class="pull-left" />
<div class="media-body" itemprop="reviewRating" itemscope itemtype="http://schema.org/Rating">
<meta itemprop="ratingValue" content="{$RATING}" />
<p>
{intl d="comment.fo.default" l="By <strong>%username</strong>" username={$username}}
{if $RATING}<span class="text-primary">{comment_stars value=$RATING}</span>{/if}
</p>
<h3 class="comment-title media-heading" itemprop="name">{$TITLE}</h3>
<p itemprop="reviewBody" class="comment-message">{$CONTENT}</p>
<div class="comment-alert alert hidden"></div>
<ul class="comment-extra list-inline">
<li class="comment-date">{format_date date="{$CREATED}" output="date"}</li>
{if $VERIFIED}
<li class="comment-verified comment--is-verified">{intl d="comment.fo.default" l="Verified"}</li>
{else}
<li class="comment-verified">{intl d="comment.fo.default" l="Verified"}</li>
{/if}
{if $customer_id && $customer_id == $CUSTOMER_ID}
<li><a href="{url path="/comment/delete/{$ID}"}" class="delete-trigger" data-id="{$ID}" data-message="{intl d="comment.fo.default" l="Are you sure ?"}">{intl d="comment.fo.default" l="Delete"}</a></li>
{else}
<li class="comment-abuse">
{form name="comment.abuse.form"}
<form id="form-add-comment-{$ID}" action="{url path="/comment/abuse"}" method="post" novalidate>
{form_hidden_fields form=$form}
{form_field form=$form field="id"}
<input type="hidden" name="{$name}" value="{$ID}" />
<a href="#" class="abuse-trigger">{intl d="comment.fo.default" l="Mark as inappropriate"}</a>
{/form_field}
</form>
{/form}
</li>
{/if}
</ul>
</div>
</div>
</div>
{/loop}
{if {count type="comment" ref="{$ref}" ref_id="{$ref_id}" status="1" } > $start + $count }
<div class="comments-more">
<a href="#" class="comments-more-link">{intl d="comment.fo.default" l="Load more comments..."}</a>
</div>
{/if}
{/ifloop}
{elseloop rel="comments"}
<div class="alert alert-info">
{if $start == 0 }
{intl d="comment.fo.default" l="There are no comments yet"}
{else}
{intl d="comment.fo.default" l="No more comments"}
{/if}
</div>
{/elseloop}