Jump to content

Problem z rich snippes przez błąd w skrypcie?


viz2y

Recommended Posts

Witajcie, mam problem z rich snippes, ponieważ wyświetlają się poprawnie w analizie site:ibudowa24.pl, natomiast w standardowych wynikach wyszukiwania - snippetów brak.

 

Rozwiązanie problemu polega najprawdopodobniej na wyłączeniu "ZŁ" w cenie za span, tak jak opisano to tutaj:

(Dodatkowo włączenie komentarzy dla niezalogowanych)

https://productforums.google.com/forum/#!topic/webmaster-pl/qVj95HCx6C4

 

 

Tyle że prestashop podaje cene  XX ZŁ jako:

 

{convertPrice price=$productPrice|floatval}

 

Jest szansa wyciągnąć z tego jednostkę? Jak wy radzicie sobie ze snippetami?

Link to comment
Share on other sites

Prawidłowa cena dla danych strukturalnych.

W product.tpl:

<p class="our_price_display" itemprop="offers" itemscope itemtype="https://schema.org/Offer">{strip}
  {if $product->quantity > 0}<link itemprop="availability" href="https://schema.org/InStock"/>{/if}
    {if $priceDisplay >= 0 && $priceDisplay <= 2}
      <span id="our_price_display" class="price" itemprop="price" content="{$productPrice}">{convertPrice price=$productPrice|floatval}</span>
      {if $tax_enabled  && ((isset($display_tax_label) && $display_tax_label == 1) || !isset($display_tax_label))}
        {if $priceDisplay == 1} {l s='tax excl.'}{else} {l s='tax incl.'}{/if}
      {/if}
      <meta itemprop="priceCurrency" content="{$currency->iso_code}" />

W product-list.tpl:

<div class="content_price" itemprop="offers" itemscope itemtype="https://schema.org/Offer">
  {if isset($product.show_price) && $product.show_price && !isset($restricted_country_mode)}
    <span itemprop="price" content="{$product.price}" class="price product-price">
      {hook h="displayProductPriceBlock" product=$product type="before_price"}
        {if !$priceDisplay}{convertPrice price=$product.price|floatval}{else}{convertPrice price=$product.price_tax_exc|floatval}{/if}
    </span>
    <meta itemprop="priceCurrency" content="{$currency->iso_code}" />

Test poprawności danych:

https://search.google.com/structured-data/testing-tool

Link to comment
Share on other sites

W templatce od komentarzy powywalaj wszystkie deklaracje: itemprop, itemscope, itemtype.

To samo dotyczy się akcesoriów produktu.

Jak jeden produkt ma kilka nazw i kilka różnych cen (z akcesoriów), to jest pomieszanie z poplątaniem i na pewno takich głupot google nie zaindeksuje.

I wygeneruj świeżą mapę strony to dostanie aktualny znacznik lastmod.

Link to comment
Share on other sites

Zmiany chyba pomogły, w części wyników jest ok, lecz w części nie. Od czego to może zależeć?

np. "biotynk hurtowna" jest ok, a np. "izolex dysperbit hurtownia" nie wyświetli ceny.

Dzięki za poświęcony czas.

Link to comment
Share on other sites

Bo jeden produkt ma komentarz, a drugi nie.

Moduł presty productcomments jest zrypany jeśli chodzi o googlowe rich snippety.

Dla produktu bez komentarza generuje błędne wartości ratingValue i ratingCount.

I nie ważne, że cena jest OK, taki produkt w całości jest wywalany przez boty do kibla.

Tak jak wcześniej pisałem, należy w templatkach productcomments wywalić deklaracje dla danych strukturalnych.

Albo naprawić moduł :)

 

Edit:

W module są nieprawidłowo poprzydzielane dane do typów danych Review i Rating.

Przejrzałem te błędy i zrobiłem poprawki modułu productcomments.

productcomments-extra.tpl

  <div id="product_comments_block_extra" class="hidden-print" itemprop="aggregateRating" itemscope itemtype="https://schema.org/AggregateRating">
    {if $nbComments != 0}
      <div class="comments_note clearfix">
        <span><b>{l s='Rating' mod='productcomments'} </b></span>
        <div class="star_content clearfix">
          {section name="i" start=0 loop=5 step=1}
            {if $averageTotal <= $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 = "{if isset($ratings.avg)}{$ratings.avg|round:1|escape:'html':'UTF-8'}{else}{$averageTotal|round:1|escape:'html':'UTF-8'}{/if}" />
          <meta itemprop="bestRating" content = "5" />
        </div>
      </div>
    {else}
          <meta itemprop="worstRating" content = "0" />
          <meta itemprop="ratingValue" content = "5" />
          <meta itemprop="bestRating" content = "5" />
          <meta itemprop="ratingCount" content = "1" />
    {/if}

productcomments.tpl

        <div class="comment row no-gutter" itemprop="review" itemscope itemtype="https://schema.org/Review">
          <meta itemprop="datePublished" content="{$comment.date_add|escape:'html':'UTF-8'|substr:0:10}" />
          <div class="comment_author col-sm-3 col-md-2">
            <div class="form-group">
              <div><b>{l s='Grade' mod='productcomments'}</b></div>
              <div class="star_content clearfix"  itemprop="reviewRating" itemscope itemtype="https://schema.org/Rating">
              <meta itemprop="ratingValue" content = "{$comment.grade|escape:'html':'UTF-8'}" />
                {section name="i" start=0 loop=5 step=1}
                  {if $comment.grade <= $smarty.section.i.index}
                    <div class="star"></div>
                  {else}
                    <div class="star star_on"></div>
                  {/if}
                {/section}
              </div>
            </div>
            <div class="form-group">
              <b itemprop="author">{$comment.customer_name|escape:'html':'UTF-8'}</b>
              <p>{dateFormat date=$comment.date_add|escape:'html':'UTF-8' full=0}</p>
            </div>
          </div>
          <div class="comment_details col-sm-9 col-md-10">
            <p>
              <b itemprop="name">{$comment.title}</b>
            </p>
            <p itemprop="reviewBody">{$comment.content|escape:'html':'UTF-8'|nl2br}</p>

Klasy css pewnie masz inne w swoim szablonie, to zostaw swoje klasy.

Edited by e_com (see edit history)
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...