Jump to content

AggregateRating


DanyWay

Recommended Posts

Didn't you edit the productcomments module?

Go to: Advanced Parameters -> Performance

1. Template compilation = Force compilation

2. Smart cache for JavaScript = Disable

3. Save

4. Clear cache (blue button)

5. Template compilation = Recompile templates if the files have been updated

6. Save

Edited by Guest (see edit history)
Link to comment
Share on other sites

Thanks for the help. But it does not work

In fact the productcomments module has a productcomments.tpl file

with this code for the reviewRating

<div class="star_content clearfix" itemprop="reviewRating" itemscope itemtype="https://schema.org/Rating">
                                    {section name="i" start=0 loop=5 step=1}
                                        {if $comment.grade le $smarty.section.i.index}
                                            <div class="star"></div>
                                        {else}
                                            <div class="star star_on"></div>
                                        {/if}
                                    {/section}
                                    <meta itemprop="worstRating" content = "0" />
                                    <meta itemprop="ratingValue" content = "{$comment.grade}" />
                                    <meta itemprop="bestRating" content = "5" />
                                </div>

And in the product.tpl I have also code for that

            {if isset($nbComments) && $nbComments > 0}
            <div class="comments_note" itemprop="aggregateRating"
              itemscope itemtype="http://schema.org/AggregateRating">
                <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}
                  <meta itemprop="ratingValue" content="{$averageTotal}">
                  <a class="nb-comments noeffect goreviews" href="#tabsection"><span itemprop="reviewCount">{l s='%s'|sprintf:$nbComments mod='productcomments'}</span> {if isset($nbComments) && $nbComments == 1}{l s='Review'}{else}{l s='Reviews'}{/if}</a>
                </div>
              </div>
            {/if}

Maybe one is not right or makes trouble.

Thanks for the help

Dany

  • Like 1
Link to comment
Share on other sites

ps_product_comment

ps_product_comment_criterion

ps_product_comment_criterion_category

ps_product_comment_criterion_lang

ps_product_comment_criterion_product

ps_product_comment_grade

ps_product_comment_report

ps_product_comment_usefulness

Link to comment
Share on other sites

No it's from scratch 1.7

Just change the theme.

Before the theme has no rating on the product page, only on the product list

This new theme has a rating on product page and it's here where the rating is not good.

 

That's why I thought it's between :

 productcomments.tpl ; https://schema.org/Rating

and

product.tpl - talk about http://schema.org/AggregateRating

I'm not very aware of that but It seems to be not the same type of Rating

Best,

Dany

Link to comment
Share on other sites

I don't know what mistakes the new version of productcomments 4.0.1 makes to you.
You always write a little information.
Turn on debug mode and put bugs here etc ....

Link to comment
Share on other sites

If it works in the default skin template, the error is in the Ayon template.
As I wrote, you cannot support foreign themes and modules.
Contact the Ayon theme developer.

Be aware that the template creator may have changed java scripts, etc.


More can not advise.

Link to comment
Share on other sites

  • 8 months later...

I have managed to fix all of Google Search Console Issues and Warnings on homepage by adding the below updates.

Themes/[Yourthemename]/templates/catalog/_partials/miniatures/products.tpl

- Add 'itemscope itemtype="http://schema.org/Product"' to <div class="product-miniature js-product-miniature" data-id-product="{$product.id_product}" data-id-product-attribute="{$product.id_product_attribute}" >

- Add itemprop="image" to the product image tag.

- Add itemprop="name" to the product -title tag.

- Add the following html tags;

<div itemprop="brand" itemtype="http://schema.org/Thing" itemscope>
                <meta itemprop="name" content="{$product.manufacturer_name}" />
            </div>
            <meta itemprop="description" content="{$product.description_short|strip_tags:'UTF-8'}"  class="invisible"/>
            {if isset($product.reference_to_display)}
                <meta itemprop="sku" content="{$product.reference_to_display}"   class="invisible"/>
            {/if}
            <meta itemprop="gtin13" content="{$product->ean13|escape:'html':'UTF-8'}" />
            <div itemprop="offers" itemscope itemtype="http://schema.org/Offer" class="invisible">
                <meta itemprop="url" content="{$product.url}" />
                <link itemprop="availability" href="http://schema.org/{if $product.quantity > 0}InStock{else}OutOfStock{/if}">
                <meta itemprop="priceCurrency" content="{$currency.iso_code}" />
                <meta itemprop="price" content="{$product.price_amount}" />
                <meta itemprop="priceValidUntil" content="{($smarty.now + (60*60*24*15))|date_format:"%Y-%m-%d"}">
            </div>

- You may need to repeat the above in the below file;

Themes/[Yourthemename]/templates/catalog/_partials/miniatures/products.tpl

If you theme support products rating/comments you will need to add the following to;

Prestashop/modules/productcomments/productscomments_review.tpl

{if $averageTotal > 0 }
<div itemprop="aggregateRating" itemscope itemtype="https://schema.org/AggregateRating">
   <meta itemprop="ratingValue" content ="{$averageTotal}" />
   <meta itemprop="reviewCount" content ="{$nbComments}" />
  </div>
<div itemprop="review" itemscope itemtype="http://schema.org/Review" class="invisible">
    <meta itemprop="author" content="{Configuration::get('PS_SHOP_NAME')}" />
    <meta itemprop="datePublished" content="{'Y'|date}-{'m'|date}-{'d'|date}">
    <div itemprop="reviewRating" itemscope itemtype="http://schema.org/Rating">
    <meta itemprop="worstRating" content="1"/>
    <meta itemprop="ratingValue" content ="{$averageTotal}" />
    <meta itemprop="bestRating" content="5" />
</div>
</div>
{/if}

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...