Jump to content

Problem with Product Comments Module


Recommended Posts

Hello,

 

I am facing problem with module Product Comments. When I finished comment and review I clicked on "SEND" button but nothing happened. So I checked Module Product Comments and it showes New update of this version so I updated for the latest version but after that it shows error message "Can not install". I also tried manually download Module from Prestashop website and replace by FTP there the new version but now it still can not install.

 

Does anybody know how to fix it?

 

Thank you

Link to comment
Share on other sites

No module update should not be performed on 1.5 anymore. Get a fresh 1.5 zip file, grab the productcomments module and upload all files to your site, overwriting the ones on the server.

 

When it's done, can you share the site's url? You might have a javascript issue

Link to comment
Share on other sites

Hello dear, it is not working :-( I download Prestashop 1.5.4.1 I took module productcomments and I replaced module in my FTP but it is not working. When I click in Administration to Install module it it just shows Installation was not successful.

Do you have some advices or can I give you my access?

Thanks

Link to comment
Share on other sites

try to remove these tables from database:

PREFIX_product_comment

PREFIX_product_comment_criterion

PREFIX_product_comment_criterion_product

PREFIX_product_comment_criterion_lang

PREFIX_product_comment_criterion_category

PREFIX_product_comment_grade

PREFIX_product_comment_usefulness

PREFIX_product_comment_report

 

and then try to install module again.

Link to comment
Share on other sites

This is the error:
 
productcomments_url_rewrite is not defined

 

Should be defined here

 

{addJsDef productcomments_url_rewrite=$productcomments_url_rewriting_activated|boolval}

 

themes\default-bootstrap\modules\productcomments.tpl

Check that you have it in your theme as well, or in the original tpl

Link to comment
Share on other sites

Vekia: No unfortunately I can not see your comment in Backoffice :-(

 

Nemo1: I found that file but can not see {addJsDef productcomments_url_rewrite=$productcomments_url_rewriting_activated|boolval}

 

I am sending you here script of productcomments.tpl. What I should to change to let it works?

Thank you :)

 

<script type="text/javascript">
var productcomments_controller_url = '{$productcomments_controller_url}';
var confirm_report_message = '{l s='Are you sure you want report this comment?' mod='productcomments' js=1}';
var secure_key = '{$secure_key}';
var productcomments_url_rewrite = '{$productcomments_url_rewriting_activated}';
var productcomment_added = '{l s='Your comment has been added!' mod='productcomments' js=1}';
var productcomment_added_moderation = '{l s='Your comment has been added and will be available once approved by a moderator' mod='productcomments' js=1}';
var productcomment_title = '{l s='New comment' mod='productcomments' js=1}';
var productcomment_ok = '{l s='OK' mod='productcomments' js=1}';
var moderation_active = {$moderation_active};
</script>

<div id="idTab5">
    <div id="product_comments_block_tab">
    {if $comments}
        {foreach from=$comments item=comment}
            {if $comment.content}
            <div class="comment clearfix">
                <div class="comment_author">
                    <span>{l s='Grade' mod='productcomments'}&nbsp</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>
                <div class="comment_details">
                    <p><strong>{$comment.title}</strong></p>
                    <p>{$comment.content|escape:'html':'UTF-8'|nl2br}</p>
                    <ul>
                        {if $comment.total_advice > 0}
                            <li>{l s='%1$d out of %2$d people found this review useful.' sprintf=[$comment.total_useful,$comment.total_advice] mod='productcomments'}</li>
                        {/if}
                        {if $logged == 1}
                            {if !$comment.customer_advice}
                            <li>{l s='Was this comment useful to you?' mod='productcomments'}<button class="usefulness_btn" data-is-usefull="1" data-id-product-comment="{$comment.id_product_comment}">{l s='yes' mod='productcomments'}</button><button class="usefulness_btn" data-is-usefull="0" data-id-product-comment="{$comment.id_product_comment}">{l s='no' mod='productcomments'}</button></li>
                            {/if}
                            {if !$comment.customer_report}
                            <li><span class="report_btn" data-id-product-comment="{$comment.id_product_comment}">{l s='Report abuse' mod='productcomments'}</span></li>
                            {/if}
                        {/if}
                    </ul>
                </div>
            </div>
            {/if}
        {/foreach}
        {if (!$too_early AND ($logged OR $allow_guests))}
        <p class="align_center">
            <a id="new_comment_tab_btn" class="open-comment-form" href="#new_comment_form">{l s='Write your review' mod='productcomments'} !</a>
        </p>
        {/if}
    {else}
        {if (!$too_early AND ($logged OR $allow_guests))}
        <p class="align_center">
            <a id="new_comment_tab_btn" class="open-comment-form" href="#new_comment_form">{l s='Be the first to write your review' mod='productcomments'} !</a>
        </p>
        {else}
        <p class="align_center">{l s='No customer comments for the moment.' mod='productcomments'}</p>
        {/if}
    {/if}    
    </div>
</div>
{if isset($product) && $product}
<!-- Fancybox -->
<div style="display: none;">
    <div id="new_comment_form">
        <form id="id_new_comment_form" action="#">
            <h2 class="title">{l s='Write your review' mod='productcomments'}</h2>
            {if isset($product) && $product}
            <div class="product clearfix">
                <img src="{$link->getImageLink($product->link_rewrite, $productcomment_cover, 'home_default')|escape:'html'}" height="{$homeSize.height}" width="{$homeSize.width}" alt="{$product->name|escape:html:'UTF-8'}" />
                <div class="product_desc">
                    <p class="product_name"><strong>{$product->name}</strong></p>
                    {$product->description_short}
                </div>
            </div>
            {/if}
            <div class="new_comment_form_content">
                <h2>{l s='Write your review' mod='productcomments'}</h2>

                <div id="new_comment_form_error" class="error" style="display: none;">
                    <ul></ul>
                </div>

                {if $criterions|@count > 0}
                    <ul id="criterions_list">
                    {foreach from=$criterions item='criterion'}
                        <li>
                            <label>{$criterion.name|escape:'html':'UTF-8'}:</label>
                            <div class="star_content">
                                <input class="star" type="radio" name="criterion[{$criterion.id_product_comment_criterion|round}]" value="1" />
                                <input class="star" type="radio" name="criterion[{$criterion.id_product_comment_criterion|round}]" value="2" />
                                <input class="star" type="radio" name="criterion[{$criterion.id_product_comment_criterion|round}]" value="3" checked="checked" />
                                <input class="star" type="radio" name="criterion[{$criterion.id_product_comment_criterion|round}]" value="4" />
                                <input class="star" type="radio" name="criterion[{$criterion.id_product_comment_criterion|round}]" value="5" />
                            </div>
                            <div class="clearfix"></div>
                        </li>
                    {/foreach}
                    </ul>
                {/if}

                <label for="comment_title">{l s='Title' mod='productcomments'}: <sup class="required">*</sup></label>
                <input id="comment_title" name="title" type="text" value=""/>

                <label for="content">{l s='Comment' mod='productcomments'}: <sup class="required">*</sup></label>
                <textarea id="content" name="content"></textarea>

                {if $allow_guests == true && $logged == 0}
                <label>{l s='Your name' mod='productcomments'}: <sup class="required">*</sup></label>
                <input id="commentCustomerName" name="customer_name" type="text" value=""/>
                {/if}

                <div id="new_comment_form_footer">
                    <input id="id_product_comment_send" name="id_product" type="hidden" value='{$id_product_comment_form}' />
                    <p class="fl required"><sup>*</sup> {l s='Required fields' mod='productcomments'}</p>
                    <p class="fr">
                        <button id="submitNewMessage" name="submitMessage" type="submit">{l s='Send' mod='productcomments'}</button> 
                        {l s='or' mod='productcomments'} <a href="#" onclick="$.fancybox.close();">{l s='Cancel' mod='productcomments'}</a>
                    </p>
                    <div class="clearfix"></div>
                </div>
            </div>
        </form><!-- /end new_comment_form_content -->
    </div>
</div>
<!-- End fancybox -->
{/if}

Link to comment
Share on other sites

Hm, weird, it's different from the default one I have.

 

Anyway, add this at the very end

 

 

{strip}
{addJsDef productcomments_controller_url=$productcomments_controller_url|@addcslashes:'\''}
{addJsDef moderation_active=$moderation_active|boolval}
{addJsDef productcomments_url_rewrite=$productcomments_url_rewriting_activated|boolval}
{addJsDef secure_key=$secure_key}
 
{addJsDefL name=confirm_report_message}{l s='Are you sure you want report this comment?' mod='productcomments' js=1}{/addJsDefL}
{addJsDefL name=productcomment_added}{l s='Your comment has been added!' mod='productcomments' js=1}{/addJsDefL}
{addJsDefL name=productcomment_added_moderation}{l s='Your comment has been added and will be available once approved by a moderator' mod='productcomments' js=1}{/addJsDefL}
{addJsDefL name=productcomment_title}{l s='New comment' mod='productcomments' js=1}{/addJsDefL}
{addJsDefL name=productcomment_ok}{l s='OK' mod='productcomments' js=1}{/addJsDefL}
{/strip}
 
You can get rid of duplicate declarations at the beginning or your file
Link to comment
Share on other sites

Thanks Nemo,

When I delete these:

<script type="text/javascript">
var productcomments_controller_url = '{$productcomments_controller_url}';
var confirm_report_message = '{l s='Are you sure you want report this comment?' mod='productcomments' js=1}';
var secure_key = '{$secure_key}';
var productcomments_url_rewrite = '{$productcomments_url_rewriting_activated}';
var productcomment_added = '{l s='Your comment has been added!' mod='productcomments' js=1}';
var productcomment_added_moderation = '{l s='Your comment has been added and will be available once approved by a moderator' mod='productcomments' js=1}';
var productcomment_title = '{l s='New comment' mod='productcomments' js=1}';
var productcomment_ok = '{l s='OK' mod='productcomments' js=1}';
var moderation_active = {$moderation_active};
</script>

 

And add these in the very end:

{strip}

{addJsDef productcomments_controller_url=$productcomments_controller_url|@addcslashes:'\''}
{addJsDef moderation_active=$moderation_active|boolval}
{addJsDef productcomments_url_rewrite=$productcomments_url_rewriting_activated|boolval}
{addJsDef secure_key=$secure_key}
 
{addJsDefL name=confirm_report_message}{l s='Are you sure you want report this comment?' mod='productcomments' js=1}{/addJsDefL}
{addJsDefL name=productcomment_added}{l s='Your comment has been added!' mod='productcomments' js=1}{/addJsDefL}
{addJsDefL name=productcomment_added_moderation}{l s='Your comment has been added and will be available once approved by a moderator' mod='productcomments' js=1}{/addJsDefL}
{addJsDefL name=productcomment_title}{l s='New comment' mod='productcomments' js=1}{/addJsDefL}
{addJsDefL name=productcomment_ok}{l s='OK' mod='productcomments' js=1}{/addJsDefL}
{/strip}
 
It is not working, I could not even load the page.
 
Please do you have another idea?

Thanks
Link to comment
Share on other sites

I have seen this problem before and it seems it is common among the 1.4 and 1.5 PS users.

 

can you try the following:

 

go to modules/productcomments/js/productcomments.js (BUT PLZ MAKE A COPY OF THAT AS A 1ST STEP)

 

change ligne 66 (or something like that, in my file it is ligne 66)

data: $('#id_new_comment_form').serialize(),

to

data: $('#new_comment_form form').serialize(),

then clear the cache in your BO as well as in your browsers.

 

let us know the result.

 

DO NOT FORGET TO MAKE A COPY OF THE ORIGINAL.

Link to comment
Share on other sites

Hi, my Prestashop is v1.5.4.1.

 

Unfortunately, I am not having any data: $('#id_new_comment_form').serialize(), line in my file. Below is all the code I have in that file. Do you know what I should to change or rewrite?

 

$(function() {
    $('input[@type=radio].star').rating();
    $('.auto-submit-star').rating();

    $('.open-comment-form').fancybox({
        'hideOnContentClick': false
    });

    $('button.usefulness_btn').click(function() {
        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();
                });
            }
        });
    });

    $('span.report_btn').click(function() {
        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();
                    });
                }
            });
        }
    });

    $('#submitNewMessage').click(function(e) {
        // Kill default behaviour
        e.preventDefault();

        // Form element

        url_options = parseInt(productcomments_url_rewrite) ? '?' : '&';
        $.ajax({
            url: productcomments_controller_url + url_options + 'action=add_comment&secure_key=' + secure_key + '&rand=' + new Date().getTime(),
            data: $('#fancybox-content form').serialize(),
            type: 'POST',
            headers: { "cache-control": "no-cache" },
            dataType: "json",
            success: function(data){
                if (data.result)
                {
                    $.fancybox.close();
                    document.location.href = document.location.href;
                }
                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');
                }
            }
        });
        return false;
    });
});

 

Link to comment
Share on other sites

Nemo1: How can I turn on "Error reporting"? I had just blank screen when I open some product

 

Walidon: My PS version is 1.5.4.1 and I used default module for this version, when I download module for PS 1.5.6.2 and I replaced by this module I had the same problem as with Nemo = blank screen

 

Please do you have another advices?

Thank you

Link to comment
Share on other sites

to turn error reporting on; please follow these steps:

1- Navigate to the PrestaShop 1.5 root folder.
2- From there, navigate the path /config/defines.inc.php
3- Open up the defines.inc.php file in the text editor.
4- Find the line of code that reads "define('_PS_MODE_DEV_', false)" This is line 28 by default in PrestaShop 1.5.
5- Change it to read "define('_PS_MODE_DEV_', true)".

  • Like 1
Link to comment
Share on other sites

I followed walidon steps and I add in the very end your code. The result is the same: The page is just blank, there is no message error report.

 

Can I give you my accesses and you can try to fix it?

 

Thanks

Link to comment
Share on other sites

I followed walidon steps and I add in the very end your code. The result is the same: The page is just blank, there is no message error report.

 

Can I give you my accesses and you can try to fix it?

 

Thanks

 

There is no code you need to add. You simply need to change False to True..

 

Here are the steps again.

 

2- From there (the root folder), navigate the path /config/defines.inc.php

3- Open up the defines.inc.php file in the text editor.

4- Find the line of code that reads "define('_PS_MODE_DEV_', false)" This is line 28 by default in PrestaShop 1.5.

5- Change it to read "define('_PS_MODE_DEV_', true)".

  • Like 1
Link to comment
Share on other sites

Yes I did this... And then?

When I try to add comment still nothing is going to happen, I don't receive even some report.

 

When I follow these steps:

2- From there (the root folder), navigate the path /config/defines.inc.php
3- Open up the defines.inc.php file in the text editor.
4- Find the line of code that reads "define('_PS_MODE_DEV_', false)" This is line 28 by default in PrestaShop 1.5.
5- Change it to read "define('_PS_MODE_DEV_', true)".

 

What is next?

Link to comment
Share on other sites

  • 1 month later...

]in ps 1.6.0.6 not submit a comment, defines.inc error: 

  • Notice: Undefined index: tabs inC:\xampp\htdocs\people_presta\cache\smarty\compile\69\e1\e8\69e1e837423c7a1f93a2cf6e29380a91dae861c6.file.product.tpl.php on line 774

    Notice: Trying to get property of non-object in C:\xampp\htdocs\people_presta\cache\smarty\compile\69\e1\e8\69e1e837423c7a1f93a2cf6e29380a91dae861c6.file.product.tpl.php on line 774

in local, but remote server not work, no send a comment

productcomment version:v3.3.5, in v3.3.4 not work

post-319618-0-26267900-1403336250_thumb.jpg

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

]in ps 1.6.0.6 not submit a comment, defines.inc error: 

  • Notice: Undefined index: tabs inC:\xampp\htdocs\people_presta\cache\smarty\compile\69\e1\e8\69e1e837423c7a1f93a2cf6e29380a91dae861c6.file.product.tpl.php on line 774

     

    Notice: Trying to get property of non-object in C:\xampp\htdocs\people_presta\cache\smarty\compile\69\e1\e8\69e1e837423c7a1f93a2cf6e29380a91dae861c6.file.product.tpl.php on line 774

in local, but remote server not work, no send a comment

productcomment version:v3.3.5, in v3.3.4 not work

[attachment=101482:Sin título-1.jpg

 

cases like this one needs inspection so if it is possible please share remote url address

Link to comment
Share on other sites

  • 1 month later...
  • 5 months later...

Hi,

My shop is built with Prestashop 1.5.6.2
I am using the product comment module Version 2.5.

When validating the product page for w3c, I am facing the 2 following errors :

1-
Code :
<div id="new_comment_form_error" class="error" style="display: none;">
<ul></ul>
</div>
Error :
This W3C error is related to <ul></ul>, with nothing between <ul> and </ul>.

2-
Code :
<input id="id_product_comment_send" name="id_product" type="hidden" value='785' />
"id_product_comment_send" already defined
Error :
"id_product_comment_send" already defined

The same line (<input id="id_product_comment_send" name="id_product" type="hidden" value="785" />) is included twice in the product page code :
- one time in relation to the send to a friend module
- another time in relation to the product comment module


Would you have any suggestion to solve the above errors ?

Thank you in advance for any help

Patrick

 

Link to comment
Share on other sites

uls are supposed to contain li tags, I bet that's why. It's empty

The second one is the real deal. You need to make sure either of the 2 ids can be changed (ie: no javascript is bound to them). Otherwise you will break the module. Prestashop always had duplicate ids issues :(

Link to comment
Share on other sites

Hi Nemo1,

 

Thank you for your reply.

 

I did the following to solve the matter:

 

1- modules/sendtoafriend/sendtoafriend-extra.tpl

1-a

I replaced :

var id_product = $('#id_product_comment_send').val();

by

var id_product = $('#id_product_comment_sendfriend').val();

1-b

I replaced :

<input id="id_product_comment_send" name="id_product" type="hidden" value="{$stf_product->id}" /> *}

by

<input id="id_product_comment_sendfriend" name="id_product" type="hidden" value="{$stf_product->id}" />

2-themes\lytheme\modules\productcomments\productcomments.tpl

 

I replaced 

<ul></ul

by

<ul><li></li></ul>

So, the two W3C errors were solved.

 

Patrick

Edited by patrmich (see edit history)
  • Like 1
Link to comment
Share on other sites

  • 1 year later...

Hello,

 

I have the same problem, when i click on submit button, nothing happen.

 

http://www.thefreeglasses.com/kids-eyewear-and-blue-light-blocker-computer-glasses/106-addison-classic-pink-circular-and-kids-spectacles.html

 

I thought it was because a module, i deleted it and lost 5000 of data. I really don't know know how to fix this problem. I tried for hours.. I'm very tired.

 

I installed Firebug, and i can see an error:

500 Internal Server Error
  1.64s
[PrestaShopDatabaseException]

Unknown column 'bdfb' in 'where clause'

SELECT p.*, pl.params, pl.id_lang 
				FROM ps_appagebuilder p 
					LEFT JOIN ps_appagebuilder_shop ps ON (ps.id_appagebuilder = p.id_appagebuilder AND id_shop=1) 
					LEFT JOIN ps_appagebuilder_lang pl ON (pl.id_appagebuilder = p.id_appagebuilder)
				WHERE 
					pl.id_lang=1
					AND ps.id_shop=1
					AND p.id_appagebuilder_positions IN (39,bdfb,41,42)
				ORDER BY p.id_appagebuilder


at line 791 in file classes/db/Db.php

786.         if ($webservice_call && $errno) {
787.             $dbg = debug_backtrace();
788.             WebserviceRequest::getInstance()->setError(500, '[SQL Error] '.$this->getMsgError().'. From '.(isset($dbg[3]['class']) ? $dbg[3]['class'] : '').'->'.$dbg[3]['function'].'() Query was : '.$sql, 97);
789.         } elseif (_PS_DEBUG_SQL_ && $errno && !defined('PS_INSTALLATION_IN_PROGRESS')) {
790.             if ($sql) {
791.                 throw new PrestaShopDatabaseException($this->getMsgError().'<br /><br /><pre>'.$sql.'</pre>');
792.             }
793. 
794.             throw new PrestaShopDatabaseException($this->getMsgError());
795.         }
796.     }

    DbCore->displayError - [line 425 - classes/db/Db.php] - [1 Arguments]
    DbCore->query - [line 643 - classes/db/Db.php] - [1 Arguments]
    DbCore->executeS - [line 280 - modules/appagebuilder/classes/ApPageBuilderModel.php] - [1 Arguments]
    ApPageBuilderModel->getAllItems - [line 1371 - modules/appagebuilder/appagebuilder.php] - [3 Arguments]
    APPageBuilder->hookdisplayHeader - [line 587 - classes/Hook.php] - [1 Arguments]
    HookCore::coreCallHook - [line 542 - classes/Hook.php] - [3 Arguments]
    HookCore::exec - [line 579 - classes/controller/FrontController.php] - [1 Arguments]
    FrontControllerCore->initContent - [line 101 - classes/controller/ModuleFrontController.php]
    ModuleFrontControllerCore->initContent - [line 44 - modules/productcomments/controllers/front/default.php]
    ProductCommentsDefaultModuleFrontController->initContent - [line 189 - classes/controller/Controller.php]
    ControllerCore->run - [line 367 - classes/Dispatcher.php]
    DispatcherCore->dispatch - [line 28 - index.php]

I noticed when i delete this file: /modules/appagebuilder/appagebuilder.php I can submit a comment.

 

I'm really exhausted.. Do you have any idea?

Link to comment
Share on other sites

That bdfd thing is supposed to be a number. It's not between quotes so SQL treats it as a column. You have to whether add quotes around those numbers in the function, or find out why the app builder uses that as position number

Link to comment
Share on other sites

That bdfd thing is supposed to be a number. It's not between quotes so SQL treats it as a column. You have to whether add quotes around those numbers in the function, or find out why the app builder uses that as position number

 

Thank you Nemo1, it helped me a lot.

Link to comment
Share on other sites

  • 9 months later...

Hello, I just installed this module but I still get the same error when trying to using it, when I click the button 'Write a review' I keep getting a message error saying 'The requested content cannot be loaded, please try again later' ... I also noticed that the js files of this module won't load when I'm on a product page, how can I fix that ? (sorry, but my english isn't this good) 

Link to comment
Share on other sites

The js files doesn't appear when I check the sources (but only on the front store) , I suppose that they must be on modules > productcomments > js > [js files]

Cause when I'm on the backoffice the file 'moderate.js' load in this folder

It's like the module isn't even trying to load its js files when on the front

 

Also, yes it's a custom template but not from me, so I don't know much about it... 

 

Thank you for answering !

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

  • 2 weeks later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...