Hardwell Posted January 14, 2014 Share Posted January 14, 2014 Bonjour tout le monde, J'utilise le module "commentaires produit" donc de base de prestashop. Je souhaiterai afficher le note moyenne dans mon fichier product.tpl, comment faire ? Merci Link to comment Share on other sites More sharing options...
Agostini Julien Posted January 14, 2014 Share Posted January 14, 2014 Bonsoir, Si je ne dis pas de bêtises la variable Smarty "{$averageTotal}" devrait vous combler... Link to comment Share on other sites More sharing options...
Hardwell Posted January 15, 2014 Author Share Posted January 15, 2014 Bonjour agostini, tout d'abord merci pour ta réponse qui effectivement fonctionne, seul soucis je souhaitais plutôt afficher les étoiles que le chiffre, et également, dans le cas d'un produit sans avis, il est affiché 0, pas très cool ^^ Crois tu que c'est possible ? Link to comment Share on other sites More sharing options...
Agostini Julien Posted January 15, 2014 Share Posted January 15, 2014 Quelle version de Prestashop utilise tu ? Car normalement le principe de la note moyenne avec des étoiles est native avec le module "productcomments" Link to comment Share on other sites More sharing options...
Hardwell Posted January 15, 2014 Author Share Posted January 15, 2014 J'utilise la 1.5.2, effectivement il me semble qu'il y a quelque temps j'avais bel et bien les étoiles d'affichées à la place des chiffres, mais là j'ai dû faire une mauvaise manip entre temps :/ Link to comment Share on other sites More sharing options...
Agostini Julien Posted January 15, 2014 Share Posted January 15, 2014 Peux tu donnez un extrait de ton fichier "productcomments-extra.tpl" ? Link to comment Share on other sites More sharing options...
Hardwell Posted January 15, 2014 Author Share Posted January 15, 2014 J'étais justement dedans, je te donne la totalité, à noter que lorsqu'un commentaire est déposé, les étoiles sont bien affichées quand même <script type="text/javascript"> $(function(){ $('a[href=#idTab5]').click(function(){ $('*[id^="idTab"]').addClass('block_hidden_only_for_screen'); $('div#idTab5').removeClass('block_hidden_only_for_screen'); $('ul#more_info_tabs a[href^="#idTab"]').removeClass('selected'); $('a[href="#idTab5"]').addClass('selected'); }); }); </script> <div id="product_comments_block_extra"> {if $nbComments != 0} <div class="comments_note"> <span>{l s='Average grade' mod='productcomments'} </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} <div class="comments_advices"> {if $nbComments != 0} <a href="#idTab5">{l s='Lire les avis' mod='productcomments'} ({$nbComments})</a><br/> {/if} {if ($too_early == false AND ($logged OR $allow_guests))} <a class="open-comment-form" href="#new_comment_form">{l s='Write your review' mod='productcomments'}</a> {/if} </div> </div> <!-- /Module ProductComments --> Link to comment Share on other sites More sharing options...
Agostini Julien Posted January 15, 2014 Share Posted January 15, 2014 Je ne vois pas de problème à tu un "override" de ce fichier ".tpl" dans ton thème ? Link to comment Share on other sites More sharing options...
Hardwell Posted January 15, 2014 Author Share Posted January 15, 2014 Négatif je n'ai pas d'override :/ Bon ce n'est pas grave je vais me débrouiller autrement, néanmoins je te sollicite encore, quand une personne donne son avis elle à trois critères à renseigner à l'aide d'étoiles, j'aimerai pouvoir afficher les 3 critères dans son commentaire car là je n'ai que la note globale du commentaire. Possible ? Link to comment Share on other sites More sharing options...
Agostini Julien Posted January 15, 2014 Share Posted January 15, 2014 Bien sûr tout est possible... c'est juste une question de temps et de patience... <script type="text/javascript"> $(function(){ $('a[href=#idTab5]').click(function(){ $('*[id^="idTab"]').addClass('block_hidden_only_for_screen'); $('div#idTab5').removeClass('block_hidden_only_for_screen'); $('ul#more_info_tabs a[href^="#idTab"]').removeClass('selected'); $('a[href="#idTab5"]').addClass('selected'); }); }); </script> <div id="product_comments_block_extra"> {if $nbComments != 0} {foreach $criterions as $criterion} <div class="comments_note"> <span>{$criterion.name} : </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> <div class="clear"></div> {/foreach} {/if} <div class="comments_advices"> {if $nbComments != 0} <a href="#idTab5">{l s='Lire les avis' mod='productcomments'} ({$nbComments})</a><br/> {/if} {if ($too_early == false AND ($logged OR $allow_guests))} <a class="open-comment-form" href="#new_comment_form">{l s='Write your review' mod='productcomments'}</a> {/if} </div> </div> <!-- /Module ProductComments --> Bonne continuation Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now