NemoPS Posted April 17, 2013 Share Posted April 17, 2013 Hi everybody! I just published a new tutorial: In this one, we'll see how to display the star rating under eachproduct name in the product list. here is the link http://nemops.com/prestashop-product-rating-product-list/ Cheers! Fabio 4 Link to comment Share on other sites More sharing options...
PascalVG Posted April 17, 2013 Share Posted April 17, 2013 Hi Fabio, Love it. Very elegant and great example of use of hooks. Thanks for taking the time to educate us all :-) Pascal (N.B. Wrote a few comments in the comment field directly on the site. Please have a look there) Link to comment Share on other sites More sharing options...
NemoPS Posted April 17, 2013 Author Share Posted April 17, 2013 Hi Pascal! Thanks for your comments, typos corrected as you suggested Link to comment Share on other sites More sharing options...
razaro Posted April 17, 2013 Share Posted April 17, 2013 Thanks for great tutorial 5/5 stars Link to comment Share on other sites More sharing options...
Bejo Posted June 19, 2013 Share Posted June 19, 2013 (edited) could i change like attachment below? Edited June 19, 2013 by Bejo (see edit history) Link to comment Share on other sites More sharing options...
NemoPS Posted June 19, 2013 Author Share Posted June 19, 2013 That's not exactly related as this is for the product list. Anyway yes, but you will need to use absolute positioning in the css as you want to put another thiong between the module's tpl divs. OR, you can edit the product_extra template of the comments module and add the print link there Link to comment Share on other sites More sharing options...
Bejo Posted June 19, 2013 Share Posted June 19, 2013 <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='Read user reviews' 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...
NemoPS Posted June 19, 2013 Author Share Posted June 19, 2013 I see, well in that case I suggest you open another topic since it's not related to this one People will be able to help you a lot better that way Link to comment Share on other sites More sharing options...
Atch Posted August 7, 2013 Share Posted August 7, 2013 Good job Nemo1 Link to comment Share on other sites More sharing options...
rgwhitaker Posted August 28, 2013 Share Posted August 28, 2013 I'm trying to get this to work, but can 't. I can't even get Step 3, adding "hey there" to work. How can I get it to work? Link to comment Share on other sites More sharing options...
razaro Posted August 29, 2013 Share Posted August 29, 2013 Try to reset module, that way registerHook(‘productInList’) should add new hook to database. Link to comment Share on other sites More sharing options...
rgwhitaker Posted August 29, 2013 Share Posted August 29, 2013 Razaro: I tried that. It didn't work. Link to comment Share on other sites More sharing options...
Nikpro Posted January 23, 2014 Share Posted January 23, 2014 Hi everybody! I just published a new tutorial: In this one, we'll see how to display the star rating under eachproduct name in the product list. here is the link http://nemops.com/prestashop-product-rating-product-list/ Cheers! Fabio Give solution for 1,411 Link to comment Share on other sites More sharing options...
patrmich Posted May 11, 2015 Share Posted May 11, 2015 Hi, Thank you for this tutorial. Is there a way to add the number of reviews besides the stars ? Thank you in advance for any suggestion. Patrick Link to comment Share on other sites More sharing options...
StefArts Posted January 16, 2017 Share Posted January 16, 2017 (edited) Hello, Many thanks for this tutorial. It help me a lot. I have installed it on my prestashop 1.6.1.6 I have made some changes in order to have reviews counting: Here is the code: // Product Stars On Product List public function hookProductInList($params) { require_once(dirname(__FILE__).'/ProductComment.php'); require_once(dirname(__FILE__).'/ProductCommentCriterion.php'); $id_product = $params['idproduct']; $product_average = 0; $grades = ProductComment::getAveragesByProduct($id_product, $this->context->language->id); $criterions = ProductCommentCriterion::getByProduct($id_product, $this->context->language->id); $grade_total = 0; if (count($grades) > 0) { foreach ($criterions as $criterion) { if (isset($grades[$criterion['id_product_comment_criterion']])) { $grade_total += (float)($grades[$criterion['id_product_comment_criterion']]); } } $product_average = $grade_total / count($criterions); $this->context->smarty->assign('average_total', (int)$product_average); // Reviews Counting $this->smarty->assign(array( 'nbComments' => (int) ProductComment::getCommentNumber($id_product), )); return $this->display(__FILE__, '/product-list-rating.tpl'); } } // End Of Product Stars On Product List I only have PHP Notices: Trying to get property of non-object in .........productcomments.tpl.php on line 196 Trying to get property of non-object in .........productcomments.tpl.php on line 200 Trying to get property of non-object in .........productcomments.tpl.php on line 203 Undefined index: product in ...cache/smarty/compile/...file.product-list-rating.tpl.php on line 58 Here is the code of the smarty productcomments.tpl.php " height="<?php echo $_smarty_tpl->tpl_vars['mediumSize']->value['height'];?> " width="<?php echo $_smarty_tpl->tpl_vars['mediumSize']->value['width'];?> " alt="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['product']->value->name, ENT_QUOTES, 'UTF-8', true);?> " /> <div class="product_desc"> <p class="product_name"> <strong><?php echo $_smarty_tpl->tpl_vars['product']->value->name;?> </strong> </p> <?php echo $_smarty_tpl->tpl_vars['product']->value->description_short;?> Here is the code of the smarty product-list-rating.tpl.php <?php if ($_smarty_tpl->getVariable('smarty')->value['section']['i']['index']<$_smarty_tpl->tpl_vars['average_total']->value) {?> <div class="star star_on"><a href="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['product']->value['link'], ENT_QUOTES, 'UTF-8', true);?> "></a></div> I believe that is something wrong with tpl_vars['product'] but I do not know how to solve it Any help? Thank you. Regards Edited January 17, 2017 by StefArts (see edit history) Link to comment Share on other sites More sharing options...
angelt Posted February 6, 2017 Share Posted February 6, 2017 (edited) Do you know how to display total number of different stars for one product (summarize of previews) before each one preview?Example: http://live.yithemes.com/nielsen/product/fashion-shoes/#reviews Edited February 6, 2017 by angelt (see edit history) Link to comment Share on other sites More sharing options...
angelt Posted February 7, 2017 Share Posted February 7, 2017 After one day I made it! Link to comment Share on other sites More sharing options...
McHerve Posted June 22, 2017 Share Posted June 22, 2017 (edited) beuuuh…where is the answer? Edited June 22, 2017 by McHerve (see edit history) 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