Jump to content

Adding support for Rich Snippets to ProductComments in 1.5.1


Recommended Posts

Just walking through the code of productcomments module in 1.5 I see that we can add support for rich snippets for votes on product page.

 

Please let me know if this is the optimal way or something else is needed. I tested the url on rich snippets tool and it is getting parsed by the toot and votes are correctly displayed.

 

Edit file: productcomments-extra.tpl

 

Change:

 

<div id="product_comments_block_extra">
{if $nbComments != 0}
<div class="comments_note">
 <span>{l s='Average grade' mod='productcomments'}&nbsp</span>
 <div class="star_content clearfix">
 {section name="i" start=0 loop=5 step=1}
  {if $averageTotal le $smarty.section.i.index}
<div class="star"></div>
  {else}
<div class="star star_on"></div>
  {/if}
 {/section}
 </div>
</div>
{/if}

 

To:

 

<div id="product_comments_block_extra">
{if $nbComments != 0}
<div class="comments_note">
 <span>{l s='Average grade' mod='productcomments'}&nbsp</span>
 <div class="star_content clearfix">
 {section name="i" start=0 loop=5 step=1}
  {if $averageTotal le $smarty.section.i.index}
<div class="star"></div>
  {else}
<div class="star star_on"></div>
  {/if}
 {/section}
 </div>
</div>
</br>
<span class="hreview-aggregate">
 <span class="rating">
  <span class="average">{$averageTotal}</span> out of
  <span class="best">5</span> based on
  <span class="votes">{$nbComments}</span> comment{if $nbComments > 1}s{/if}
  <span class="summary"></span>
 </span>
</span>
{/if}

 

 

***All credits goes to various free modules posted in this forum. I just learnt through understanding coding by various developers sharing their efforts to community.

  • Like 2
Link to comment
Share on other sites

  • 1 month later...
  • 1 year later...
×
×
  • Create New...