Jump to content

Small problem with Comments Module


Recommended Posts

Hello Everyone,

 

I have a small problem with the comments module.

 

When the Quantity of a product is 0. The "Write your review" link appears without a problem,

 

but when the Quantity is more than 0, the "Write your review" link dissapears.

 

I am using Prestashop 1.5.4 version.

 

Can you help?

 

Thanks a lot.

Link to comment
Share on other sites

Yes, it's a bug indeed. What I did was going into the product extra hook template for the module, and simply display 'write your review' if there is more than one. THe default 'be the first' would appear otherwise. It's normal, so no other way around(that I know)

Link to comment
Share on other sites

productcomments.tpl file, change this:

<div id="product_comments_block_tab">
{if $comments}
 {foreach from=$comments item=comment}
  {if $comment.content}
  <div class="comment clearfix">
   <div class="comment_author">
 <span>{l s='Grade' mod='productcomments'}&nbsp</span>
 <div class="star_content clearfix">
 {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}
 </div>
 <div class="comment_author_infos">
  <strong>{$comment.customer_name|escape:'html':'UTF-8'}</strong><br/>
  <em>{dateFormat date=$comment.date_add|escape:'html':'UTF-8' full=0}</em>
 </div>
   </div>
   <div class="comment_details">
 <h4 class="title_block">{$comment.title}</h4>
 <p>{$comment.content|escape:'html':'UTF-8'|nl2br}</p>
 <ul>
  {if $comment.total_advice > 0}
   <li>{l s='%1$d out of %2$d people found this review useful.' sprintf=[$comment.total_useful,$comment.total_advice] mod='productcomments'}</li>
  {/if}
  {if $logged == 1}
   {if !$comment.customer_advice}
   <li>{l s='Was this comment useful to you?' mod='productcomments'}<button class="usefulness_btn" data-is-usefull="1" data-id-product-comment="{$comment.id_product_comment}">{l s='yes' mod='productcomments'}</button><button class="usefulness_btn" data-is-usefull="0" data-id-product-comment="{$comment.id_product_comment}">{l s='no' mod='productcomments'}</button></li>
   {/if}
   {if !$comment.customer_report}
   <li><span class="report_btn" data-id-product-comment="{$comment.id_product_comment}">{l s='Report abuse' mod='productcomments'}</span></li>
   {/if}
  {/if}
 </ul>
   </div>
  </div>
  {/if}
 {/foreach}
{else}
 {if ($too_early == false AND ($logged OR $allow_guests))}
 <p class="align_center">
  <a id="new_comment_tab_btn" class="open-comment-form" href="#new_comment_form">{l s='Be the first to write your review' mod='productcomments'} !</a>
 </p>
 {else}
 <p class="align_center">{l s='No customer comments for the moment.' mod='productcomments'}</p>
 {/if}
{/if}
</div>

Into this

 

<div id="product_comments_block_tab">
{if $comments}
 {foreach from=$comments item=comment}
  {if $comment.content}
  <div class="comment clearfix">
   <div class="comment_author">
 <span>{l s='Grade' mod='productcomments'}&nbsp</span>
 <div class="star_content clearfix">
 {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}
 </div>
 <div class="comment_author_infos">
  <strong>{$comment.customer_name|escape:'html':'UTF-8'}</strong><br/>
  <em>{dateFormat date=$comment.date_add|escape:'html':'UTF-8' full=0}</em>
 </div>
   </div>
   <div class="comment_details">
 <h4 class="title_block">{$comment.title}</h4>
 <p>{$comment.content|escape:'html':'UTF-8'|nl2br}</p>
 <ul>
  {if $comment.total_advice > 0}
   <li>{l s='%1$d out of %2$d people found this review useful.' sprintf=[$comment.total_useful,$comment.total_advice] mod='productcomments'}</li>
  {/if}
  {if $logged == 1}
   {if !$comment.customer_advice}
   <li>{l s='Was this comment useful to you?' mod='productcomments'}<button class="usefulness_btn" data-is-usefull="1" data-id-product-comment="{$comment.id_product_comment}">{l s='yes' mod='productcomments'}</button><button class="usefulness_btn" data-is-usefull="0" data-id-product-comment="{$comment.id_product_comment}">{l s='no' mod='productcomments'}</button></li>
   {/if}
   {if !$comment.customer_report}
   <li><span class="report_btn" data-id-product-comment="{$comment.id_product_comment}">{l s='Report abuse' mod='productcomments'}</span></li>
   {/if}
  {/if}
 </ul>
   </div>
  </div>
  {/if}
 {/foreach}
 {if ($too_early == false AND ($logged OR $allow_guests))}
 <p class="align_center">
  <a id="new_comment_tab_btn" class="open-comment-form" href="#new_comment_form">{l s='Add your comment' mod='productcomments'} !</a>
 </p>
 {/if}
{else}
 {if ($too_early == false AND ($logged OR $allow_guests))}
 <p class="align_center">
  <a id="new_comment_tab_btn" class="open-comment-form" href="#new_comment_form">{l s='Be the first to write your review' mod='productcomments'} !</a>
 </p>
 {else}
 <p class="align_center">{l s='No customer comments for the moment.' mod='productcomments'}</p>
 {/if}
{/if}
</div>

 

Basically, add a linne to show the comment link at the end of the comments loop

 

Not the best way, but the quickest

Link to comment
Share on other sites

Hi Nemo1, I've just tried doing the above code change in the tpl file, but it still didn't make any difference. It still seems as though it only displays the link to write the review when stock is 0 for the product.

 

Do you know of this bug has been identified by the developers?

Link to comment
Share on other sites

×
×
  • Create New...