dusticelli Posted March 20, 2016 Share Posted March 20, 2016 Hi everybody, by desired change from a third party theme, to the standard bootstrap theme to improve shop performance, I found a problem which seems to be a bug. In 1.6.1.4 When a visitor clicks on the "Read Review" button, he will be redirected to the reviews tab, but as well the "add to cart button" will be hided and a message occurs "This combination does not exist for this product. Please select another combination" this only happens with products that haven't any combinations. It does not happen to products that do have combinations. I think this is quite important, as a customer might think the product isn't available in the shop, exactly after some nice reviews did made him appetite! Here is already a bug report http://forge.prestashop.com/browse/PSCSX-7495 bit this is from december 2015 I am really wondering that this isn't yet fixed, as I guess it is quite important. Probably it is not a bug but some kind of misconfiguration? Can anybody confirm that, and even better does anyone have an idea or workaround to fix that? Link to comment Share on other sites More sharing options...
wouterb038 Posted March 22, 2016 Share Posted March 22, 2016 (edited) Hello, I made a quick solution for this:1. Edit file productcomments.js (in themes/**your-theme**/js/modules/productcomments/productcomments.js)Comment out the following code: $(document).on('click', 'a[href=#idTab5]', function(e){ $('*[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'); }); Like this: /* $(document).on('click', 'a[href=#idTab5]', function(e){ $('*[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'); }); */ After this add following code: $("#product_comments_block_extra .reviews").click(function() { $('html,body').animate({ scrollTop: $("#idTab5").offset().top}, 'slow'); }); The file should now look like this: /* * 2007-2015 PrestaShop * * NOTICE OF LICENSE * * This source file is subject to the Academic Free License (AFL 3.0) * that is bundled with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://opensource.org/licenses/afl-3.0.php * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to [email protected] so we can send you a copy immediately. * * DISCLAIMER * * Do not edit or add to this file if you wish to upgrade PrestaShop to newer * versions in the future. If you wish to customize PrestaShop for your * needs please refer to http://www.prestashop.com for more information. * * @author PrestaShop SA <[email protected]> * @copyright 2007-2015 PrestaShop SA * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA */ $(document).ready(function(){ $('input.star').rating(); $('.auto-submit-star').rating(); if (!!$.prototype.fancybox) $('.open-comment-form').fancybox({ 'autoSize' : false, 'width' : 600, 'height' : 'auto', 'hideOnContentClick': false }); $(document).on('click', '#id_new_comment_form .closefb', function(e){ e.preventDefault(); $.fancybox.close(); }); /* $(document).on('click', '.reviews', function(e){ $('*[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'); }); */ $("#product_comments_block_extra .reviews").click(function() { $('html,body').animate({ scrollTop: $("#idTab5").offset().top}, 'slow'); }); $(document).on('click', 'button.usefulness_btn', function(e){ var id_product_comment = $(this).data('id-product-comment'); var is_usefull = $(this).data('is-usefull'); var parent = $(this).parent(); $.ajax({ url: productcomments_controller_url + '?rand=' + new Date().getTime(), data: { id_product_comment: id_product_comment, action: 'comment_is_usefull', value: is_usefull }, type: 'POST', headers: { "cache-control": "no-cache" }, success: function(result){ parent.fadeOut('slow', function() { parent.remove(); }); } }); }); $(document).on('click', 'span.report_btn', function(e){ if (confirm(confirm_report_message)) { var idProductComment = $(this).data('id-product-comment'); var parent = $(this).parent(); $.ajax({ url: productcomments_controller_url + '?rand=' + new Date().getTime(), data: { id_product_comment: idProductComment, action: 'report_abuse' }, type: 'POST', headers: { "cache-control": "no-cache" }, success: function(result){ parent.fadeOut('slow', function() { parent.remove(); }); } }); } }); $(document).on('click', '#submitNewMessage', function(e){ // Kill default behaviour e.preventDefault(); // Form element url_options = '?'; if (!productcomments_url_rewrite) url_options = '&'; $.ajax({ url: productcomments_controller_url + url_options + 'action=add_comment&secure_key=' + secure_key + '&rand=' + new Date().getTime(), data: $('#id_new_comment_form').serialize(), type: 'POST', headers: { "cache-control": "no-cache" }, dataType: "json", success: function(data){ if (data.result) { $.fancybox.close(); var buttons = {}; buttons[productcomment_ok] = "productcommentRefreshPage"; fancyChooseBox(moderation_active ? productcomment_added_moderation : productcomment_added, productcomment_title, buttons); } else { $('#new_comment_form_error ul').html(''); $.each(data.errors, function(index, value) { $('#new_comment_form_error ul').append('<li>'+value+'</li>'); }); $('#new_comment_form_error').slideDown('slow'); } } }); }); }); function productcommentRefreshPage() { window.location.reload(); } 2. Edit file productcomments-extra.tpl (in themes/**your-theme**/modules/productcomments/productcomments-extra.tpl) Replace the code as shown below {* * 2007-2015 PrestaShop * * NOTICE OF LICENSE * * This source file is subject to the Academic Free License (AFL 3.0) * that is bundled with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://opensource.org/licenses/afl-3.0.php * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to [email protected] so we can send you a copy immediately. * * DISCLAIMER * * Do not edit or add to this file if you wish to upgrade PrestaShop to newer * versions in the future. If you wish to customize PrestaShop for your * needs please refer to http://www.prestashop.com for more information. * * @author PrestaShop SA <[email protected]> * @copyright 2007-2015 PrestaShop SA * @version Release: $Revision$ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA *} {if (!$content_only && (($nbComments == 0 && $too_early == false && ($is_logged || $allow_guests)) || ($nbComments != 0)))} <div id="product_comments_block_extra" class="no-print" itemprop="aggregateRating" itemscope itemtype="https://schema.org/AggregateRating"> {if $nbComments != 0} <div class="comments_note clearfix"> <span>{l s='Rating' 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} <meta itemprop="worstRating" content = "0" /> <meta itemprop="ratingValue" content = "{if isset($ratings.avg)}{$ratings.avg|round:1|escape:'html':'UTF-8'}{else}{$averageTotal|round:1|escape:'html':'UTF-8'}{/if}" /> <meta itemprop="bestRating" content = "5" /> </div> </div> <!-- .comments_note --> {/if} <ul class="comments_advices"> {if $nbComments != 0} <li> <a class="reviews"> {l s='Read reviews' mod='productcomments'} (<span itemprop="reviewCount">{$nbComments}</span>) </a> </li> {/if} {if ($too_early == false AND ($is_logged OR $allow_guests))} <li> <a class="open-comment-form" href="#new_comment_form"> {l s='Write a review' mod='productcomments'} </a> </li> {/if} </ul> </div> {/if} <!-- /Module ProductComments --> After this you have to add a bit of CSS. You can place the productcomments.css but may also in other files (for example global.css or product.css) ul.comments_advices li a.reviews:hover { cursor:pointer; } Edited March 24, 2016 by wouterb038 (see edit history) Link to comment Share on other sites More sharing options...
dusticelli Posted March 22, 2016 Author Share Posted March 22, 2016 Hey wouterb083, thanks for sharing your solution. I have just pasted your changes and it works quite good. Just curiously now the page first scrolls down to the ratings, but immedialty it scrolls up again to the top of the page http://188.68.52.113/prestademo/de/blouses/2-blouse.html Any idea? Are you as well on 1.6.1.4? I found my "productcomments.js" in different folder themes/**my-theme**/js/modules/productcomments/js/productcomments.js Link to comment Share on other sites More sharing options...
wouterb038 Posted March 24, 2016 Share Posted March 24, 2016 Hi Dusticelli,I made a mistake. You need to change te following: productcomments-extra.tpl Change this <ul class="comments_advices"> <li> <a class="reviews" href=""> .......... To. ---> <ul class="comments_advices"> <li> <a class="reviews"> .......... After this you have to add a bit of CSS. You can place the productcomments.css but may also in other files (for example global.css or product.css) ul.comments_advices li a.reviews:hover { cursor:pointer; } let me know if it worked Link to comment Share on other sites More sharing options...
dusticelli Posted March 25, 2016 Author Share Posted March 25, 2016 Hey wouterb038, thanks a lot. Now it works like a charm. Link to comment Share on other sites More sharing options...
dusticelli Posted March 30, 2016 Author Share Posted March 30, 2016 Here is a bugfix that seems to solve the problem https://github.com/PrestaShop/PrestaShop/pull/5280/files Link to comment Share on other sites More sharing options...
wouterb038 Posted April 7, 2016 Share Posted April 7, 2016 (edited) Glad it's fixed! My own solution is not completely through the structure prestashop. The other is of course simplerer and better Could you please mark this topic as [sOLVED] ? Edited April 7, 2016 by wouterb038 (see edit history) Link to comment Share on other sites More sharing options...
renaud2263 Posted October 16, 2016 Share Posted October 16, 2016 (edited) Hi, I have exactly the same problem but neither the Wouterb solution nor the Github one are ok. When I click the "read the comments" link, nothing happens. in product.js : $(window).bind('hashchange', function(){ //checkUrl(); //findCombination(); var is_combination = checkUrl(); if (is_combination) findCombination(); }); In productcomment.js ; /* $(document).on('click', 'a[href=#idTab5]', function(e){ $('*[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'); }); */ $("#product_comments_block_extra .reviews").click(function() { $('html,body').animate({ scrollTop: $("#idTab5").offset().top}, 'slow'); }); But the Chrome console shows: productcomments.js:52 Uncaught TypeError: Cannot read property 'top' of undefined(…) Then if i add this condition: if(nav.length) So no error in the console, but nothing happens on the click action. Important : I also modified the productcomments-extra.tpl as explained by Wouterb. Could you help ? Edited October 16, 2016 by renaud2263 (see edit history) Link to comment Share on other sites More sharing options...
laurent0071 Posted February 4, 2017 Share Posted February 4, 2017 Hi Dusticelli, I made a mistake. You need to change te following: productcomments-extra.tpl Change this <ul class="comments_advices"> <li> <a class="reviews" href=""> .......... To. ---> <ul class="comments_advices"> <li> <a class="reviews"> .......... After this you have to add a bit of CSS. You can place the productcomments.css but may also in other files (for example global.css or product.css) ul.comments_advices li a.reviews:hover { cursor:pointer; } let me know if it worked For me your solution is not working, I always have the same problem, can you have a look ? http://paradisdiscount.com/meizu-pro-5/34860-ecran-lcd-vitre-tactile-meizu-pro-5.html#new_comment_form Link to comment Share on other sites More sharing options...
Nando@100ASA Posted April 9, 2018 Share Posted April 9, 2018 (edited) On 30/3/2016 at 7:38 PM, dusticelli dice: Here is a bugfix that seems to solve the problem https://github.com/PrestaShop/PrestaShop/pull/5280/files Yup, it works on v1.6.1.18, perfect. Weird to see it's not included in the latest PS releases tho... anyway, it's ok now, thanks for sharing this. Edited April 9, 2018 by Nando@100ASA (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