garyjj127 Posted January 9, 2014 Share Posted January 9, 2014 (edited) I have an odd problem. I have the productcomments module installed, and have added 2 criterion "Fit" and "Quality". They show up fine when a customer writes a review, and appear with stars next to them. However, when the review shows up on the site, instead of the "Fit" and "Quality" criterion showing, it just says "Grade". I've checked my files and they seem OK, and it also happens in the default theme, so I guess I can rule out my own theme being the problem. By the way, I'm using productcomments V2.4 and Presta 1.5.6.1 Any help appreciated! Edited January 9, 2014 by garyjj127 (see edit history) Link to comment Share on other sites More sharing options...
Sharak Posted January 9, 2014 Share Posted January 9, 2014 (edited) Change this (file /themes/your_theme/modules/productcomments/productcomments.tpl): <div class="comment_author"> <span>{l s='Grade' mod='productcomments'} </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> to this: <div class="comment_author"> {foreach from=$criterions item='criterion'} <span>{$criterion.name} </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><br/> {/foreach} <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> Although it currently works fine only if both grades are the same. If they're different it shows average on both. Working on that... Edited January 9, 2014 by Sharak (see edit history) 1 Link to comment Share on other sites More sharing options...
garyjj127 Posted January 9, 2014 Author Share Posted January 9, 2014 (edited) You are a genius sir! Thanks so much for posting that, it's been bugging me for ages. As far as the star problem goes, maybe there's a way of pulling the criterion scores individually from the database? Definitely beyond me, but maybe it'll get sorted in v1.6. Edited January 9, 2014 by garyjj127 (see edit history) Link to comment Share on other sites More sharing options...
Antonio1981 Posted July 11, 2014 Share Posted July 11, 2014 (edited) Hi everybody, it doesn't work for "quality" in the star content; how can I change that? [sorry, I read just now the solution, thank you] Edited July 11, 2014 by Antonio1981 (see edit history) Link to comment Share on other sites More sharing options...
Anymore Posted November 9, 2015 Share Posted November 9, 2015 hi everybodyi changed the productcomments.tpl and the result with separated criterions are finebut to integrate the variables inside this array ( productcomments.php ) i don't found some solution maybe someone can help me out ? many thanks in advance greetings marc public function hookProductTabContent($params) { $this->context->controller->addJS($this->_path.'js/jquery.rating.pack.js'); $this->context->controller->addJS($this->_path.'js/jquery.textareaCounter.plugin.js'); $this->context->controller->addJS($this->_path.'js/productcomments.js'); $id_guest = (!$id_customer = (int)$this->context->cookie->id_customer) ? (int)$this->context->cookie->id_guest : false; $customerComment = ProductComment::getByCustomer((int)(Tools::getValue('id_product')), (int)$this->context->cookie->id_customer, true, (int)$id_guest); $averages = ProductComment::getAveragesByProduct((int)Tools::getValue('id_product'), $this->context->language->id); $averageTotal = 0; foreach ($averages as $average) $averageTotal += (float)($average); $averageTotal = count($averages) ? ($averageTotal / count($averages)) : 0; $product = $this->context->controller->getProduct(); $image = Product::getCover((int)Tools::getValue('id_product')); $cover_image = $this->context->link->getImageLink($product->link_rewrite, $image['id_image'], 'medium_default'); $this->context->smarty->assign(array( 'logged' => $this->context->customer->isLogged(true), 'action_url' => '', 'product' => $product, 'comments' => ProductComment::getByProduct((int)Tools::getValue('id_product'), 1, null, $this->context->cookie->id_customer), 'criterions' => ProductCommentCriterion::getByProduct((int)Tools::getValue('id_product'), $this->context->language->id), 'averages' => $averages, 'product_comment_path' => $this->_path, 'averageTotal' => $averageTotal, 'allow_guests' => (int)Configuration::get('PRODUCT_COMMENTS_ALLOW_GUESTS'), 'too_early' => ($customerComment && (strtotime($customerComment['date_add']) + Configuration::get('PRODUCT_COMMENTS_MINIMAL_TIME')) > time()), 'delay' => Configuration::get('PRODUCT_COMMENTS_MINIMAL_TIME'), 'id_product_comment_form' => (int)Tools::getValue('id_product'), 'secure_key' => $this->secure_key, 'productcomment_cover' => (int)Tools::getValue('id_product').'-'.(int)$image['id_image'], 'productcomment_cover_image' => $cover_image, 'mediumSize' => Image::getSize(ImageType::getFormatedName('medium')), 'nbComments' => (int)ProductComment::getCommentNumber((int)Tools::getValue('id_product')), 'productcomments_controller_url' => $this->context->link->getModuleLink('productcomments'), 'productcomments_url_rewriting_activated' => Configuration::get('PS_REWRITING_SETTINGS', 0), 'moderation_active' => (int)Configuration::get('PRODUCT_COMMENTS_MODERATE') )); $this->context->controller->pagination((int)ProductComment::getCommentNumber((int)Tools::getValue('id_product'))); return ($this->display(__FILE__, '/productcomments.tpl')); } <div id="idTab5"> <div id="product_comments_block_tab"> {if $comments} {foreach from=$comments item=comment} {if $comment.content} <div class="comment row" itemprop="review" itemscope itemtype="https://schema.org/Review"> <div class="comment_author col-sm-2"> {foreach from=$criterions item='criterion'} <span>{$criterion.name}</span> <div class="star_content clearfix"> {section name="i" start=0 loop=5 step=1} {if $test le $smarty.section.i.index} <div class="star"></div> {else} <div class="star star_on"></div> {/if} {/section} </div><br/> {/foreach} <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> <!-- .comment_author --> Link to comment Share on other sites More sharing options...
Anymore Posted November 11, 2015 Share Posted November 11, 2015 hi everybody i found some solution for prestashop 1.5 https://www.prestashop.com/forums/topic/285799-resolu-module-commentaire-afficher-les-différents-critères-en-fo-et-bo/ but for 1.6 it's not running maybe this can help someone many thanks in advance greetings marc Link to comment Share on other sites More sharing options...
Galadrum Posted December 8, 2015 Share Posted December 8, 2015 also interested in a way to make it work for PS1.6 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