Jump to content

Change the "Comments" tab in Product Comments module


Recommended Posts

Does anyone know how to change the word "Comments" to something else in the default Product Comments module?

 

I've tried looking in productcomments.tpl and product.tpl...and many, many other files. I've also tried using FireBug, but it doesn't seem like it has the functionality to pinpoint a .tpl file.

 

I tried looking for a solution online and a poster suggested to use tab.tpl. I couldn't find this file either. I'm using an alternate theme along with the default module, if it helps.

 

 

The line of code that shows up in FireBug is this:

 

<a class="idTabHrefShort selected" href="#idTab5">Comments</a>

 

However, I have no idea where that line is other than the more obvious files I've checked.

Link to comment
Share on other sites

thanks for information, btw. this is wrong way to change the texts,

you should try with

 

localization > translations tool

 

from dropdown select "modules translations" then click on flag you want to translate / change.

 

search for module on fields list and do the show there ;)

Link to comment
Share on other sites

  • 4 weeks later...
  • 8 months later...
  • 5 months later...

I also wish to edit the field name of the tab.

 

under the .tpl file I have I have found this:

 

<li><a href="#idTab5" class="idTabHrefShort">{l s='Comments' mod='productcomments'} ({$nbComments})</a></li>

 

changed it to this:

 

<li><a href="#idTab5" class="idTabHrefShort">{l s='Customer Reviews' mod='productcomments'} ({$nbCustomer Reviews})</a></li>

 

Doesn't work.

 

Any advice please?

Link to comment
Share on other sites

under 'my theme' I do have productcomments in the modules folder. When I click on this it only displays the file productcomments.tpl

 

below is the code but I cannot find what to change:

 

<div id="idTab5">
<script type="text/javascript" src="{$module_dir}js/jquery.rating.pack.js"></script>
<script type="text/javascript">
$(function(){literal}[spam-filter]/literal} $('input[@type=radio].star').rating(); {literal[spam-filter]{/literal});
$(function(){literal}[spam-filter]/literal}
$('.auto-submit-star').rating({literal}[spam-filter]/literal}
callback: function(value, link){literal}[spam-filter]/literal}
{literal[spam-filter]{/literal}
{literal[spam-filter]{/literal});
{literal[spam-filter]{/literal});
//close  comment form
function closeCommentForm(){ldelim}
$('#sendComment').slideUp('fast');
$('input#addCommentButton').fadeIn('slow');
{rdelim}
</script>
{if $comments}
{if $criterions|@count > 0}
<div class="comment_criterions">
<h2>{l s='Average grade' mod='productcomments'}</h2>
<div>
{l s='Average' mod='productcomments'}:<br />
{section loop=6 step=1 start=1 name=average}
<input class="auto-submit-star" disabled="disabled" type="radio" name="average" {if $averageTotal|round neq 0 and $smarty.section.average.index eq $averageTotal|round}checked="checked"{/if} />
{/section}
</div>
<div>
{foreach from=$criterions item=c}
<div>
{$c.name|escape:'html':'UTF-8'}<br />
{section loop=6 step=1 start=1 name=average}
<input class="auto-submit-star" disabled="disabled" type="radio" name="{$c.name|escape:'html':'UTF-8'}_{$smarty.section.average.index}" value="{$smarty.section.average.index}" {if isset($averages[$c.id_product_comment_criterion]) AND $averages[$c.id_product_comment_criterion]|round neq 0 AND $smarty.section.average.index eq $averages[$c.id_product_comment_criterion]|round}checked="checked"{/if} />
{/section}
</div>
{/foreach}
</div>
</div>
{/if}
<div class="table_block">
<table class="std">
<thead>
<tr>
<th class="first_item" style="width:120px;">{l s='From' mod='productcomments'}</th>
<th class="item">{l s='Title' mod='productcomments'}</th>
<th class="item">{l s='Comment' mod='productcomments'}</th>
</tr>
</thead>
<tbody>
{foreach from=$comments item=comment}
{if $comment.content}
<tr>
<td style="vertical-align:top">
{dateFormat date=$comment.date_add|escape:'html':'UTF-8' full=0}
{$comment.customer_name|escape:'html':'UTF-8'}.
</td>
<td style="vertical-align:top">
{$comment.title}
</td>
<td style="vertical-align: top">
{$comment.content|escape:'html':'UTF-8'|nl2br}
</td>
</tr>
{/if}
{/foreach}
</tbody>
</table>
</div>
{else}
<p class="comment_none">{l s='No customer comments for the moment.' mod='productcomments'}</p>
{/if}
{if $too_early == true}
<p>{l s='You should wait' mod='productcomments'} {$delay} {l s='second(s) before posting a new comment' mod='productcomments'}</p>
{elseif $cookie->isLogged() == true || $allow_guests == true}
<p class="comment_add"><input class="button_large" type="button" id="addCommentButton" value="{l s='Add a comment' mod='productcomments'}" onclick="$('#sendComment').slideDown('slow');$(this).slideUp('slow');" /></p>
<form action="{$action_url}" method="post" id="sendComment" style="display:none;">
<fieldset>
<p class="align_right"><a href="javascript:closeCommentForm()">X</a></p>
<p class="bold">{l s='Add a comment' mod='productcomments'}</p>
{if $criterions|@count > 0}
<table class="comment_rating">
{section loop=$criterions name=i start=0 step=1}
<tr>
<td>
<input type="hidden" name="id_product_comment_criterion_{$smarty.section.i.iteration}" value="{$criterions.id_product_comment_criterion|intval}" />
{$criterions.name|escape:'html':'UTF-8'}
</td>
<td>
<input class="star" type="radio" name="{$smarty.section.i.iteration}_grade" id="{$smarty.section.i.iteration}_grade" value="1" />
<input class="star" type="radio" name="{$smarty.section.i.iteration}_grade" value="2" />
<input class="star" type="radio" name="{$smarty.section.i.iteration}_grade" value="3" checked="checked" />
<input class="star" type="radio" name="{$smarty.section.i.iteration}_grade" value="4" />
<input class="star" type="radio" name="{$smarty.section.i.iteration}_grade" value="5" />
</td>
</tr>
{/section}
</table>
{/if}
{if $allow_guests == true && $cookie->isLogged() == false}<p><label for="customer_name">{l s='Your name:' mod='productcomments'}</label><input type="text" name="customer_name" id="customer_name" /></p>{/if}
<p><label for="comment_title">{l s='Title:' mod='productcomments'}</label><input type="text" name="title" id="comment_title" /></p>
<p><label for="content">{l s='Comment:' mod='productcomments'}</label><textarea cols="46" rows="5" name="content" id="content"></textarea></p>
<p class="submit">
<input class="button" name="submitMessage" value="{l s='Send' mod='productcomments'}" type="submit" />
</p>
</fieldset>
</form>
{else}
<p class="align_center">{l s='Only registered users can post a new comment.' mod='productcomments'}</p>
{/if}
</div>
Link to comment
Share on other sites

Then your theme does not override the tab.tpl file.

 

So now you need to check that you have recompile of smarty templates turned on.  You should go into your back office Advanced Preferences > Performance page, and enable force compile or recompile of template cache.

Link to comment
Share on other sites

  • 9 months later...

I figured this out the "proper way" after MUCH trial and error. The problem really is that PS should give a better method for honing in on a specific translation.  I'm not sure how, but perhaps an ID could be used in the TPL that can be searched for because, as you'll see from these steps, there's really no way to know what field is what other than trial & error, and that sucks (I change 42 "comments" before finding it!).  Anyway, here are the steps:

 

Assumption #1:  you're using a non-default template (but this may very well apply to default too)

Assumption #2:  your template is set up correctly for defines (if you paid for it, I'd hope this would be the case)

Assumption #3:  you're using 1.6.1 (I have no idea if these steps are relevant to other versions as this is the only version I've used)

 

  1. Back office -> Localization -> Translations
  2. Type of translation, choose "Installed modules translations"
  3. Select your theme -> yep, choose the one you're using
  4. Selet your language ->  you got it... choose appropriate language
  5. Click Modify
  6. Click "Close all fieldsets" and wait for it to change.
  7. Click same button (now called "Expand all fieldsets").  You have to do this because by default it only shows you  missing fields!  Quite confusing PS devs!!
  8. Search for "[THEMENAME] - TAB".  I hope this is the same for other themes.  For mine, it was "PANDA - TAB".   Just to confuse things even more, of course, there's going to be more than 1!!
  9. Go through them until you find the one called "Comments"
  10. Change field to your desired word (or fill it in if it is blank).
  11. Click Save

You shouldn't need to clear cache, just reload.  But if it doesn't change, then clear all your cache.  If it still doesn't change, clear your browse cache too.  If it STILL doesn't change then I guess one of the above assumptions isn't true for your case and I'm sorry.

 

PS Devs:  Seriously.... make this better!  First off, a "search" feature on the translations page would help immensely, given that there are THOUSANDS of fields.  Second, a little uniqueness wouldn't hurt!  I should be able to right click on the tab in Chrome, choose inspect element, see that it has an ID = "idTab5", search by that ID on the translations page and boom... done.

 

BTW.  The above is how you help people figure out complicated stuff... not vague references to things that only a seasoned pro could figure out.  Clarity and completeness matter!  You're welcome.

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

×
×
  • Create New...