Jump to content

Recommended Posts

Prestashop version: 1.5.3.1

 

When i`m trying to add a comment for my product i get this error:

 

  • Title is incorrect
  • Comment is incorrect
  • Customer name is incorrect
  • Product not found

 

If i`m logged i`m getting the same error message except "Customer name is incorrect"

 

I tried disabling friendly url, but i had no luck, same error.

 

 

any idea?

Link to comment
Share on other sites

  • 2 weeks later...
  • 1 month later...
  • 2 months later...

I also found the issue in PS 1.5.4.1 but only in Chrome and Firefox, in IE works fine.

 

The problem is when serializing (#fancybox-content form) fields of the comments, the solution that i found is to replace line 63 in the productcomments.js:

 

line 63 productscomments.js:

 

/ /data: $ ('# fancybox-content form'). serialize (),  

 

by this:

 

  data: $ ('# fancybox-content input, # fancybox-content textarea, # fancybox-content select'). serialize (),

 

Now, it works in Chrome and Firefox

Link to comment
Share on other sites

Hey - perusi and ukbill69 - I have no problems with product comments on the following:

 

1. Out-of-the-box version of Prestashop

2. With my Theme applied

3. Using different versions of PHP

4. All configuration parameters the same

 

Going to try adding in the plug-ins I use next on my test site and see if I can break it.

Link to comment
Share on other sites

  • 2 weeks later...

Same issue.

 

Upgraded from 1.5.4.1 to 1.5.5

 

Same errors even after applying changes to productcomments.js

 

Write a Review and get ajax error:

  • Title is incorrect
  • Comment is incorrect
  • Product not found

Screenshot attached,

 

Thanks!

 

post-582986-0-57474600-1377986783_thumb.jpg

Link to comment
Share on other sites

Issue could be in empty variables being passed, as the same version of the productcomments

module works in 1.5.4.1 but yields the error in 1.5.5. Not real sure where to look to see the field

variable values before they are being submited. Everything else in the upgrade went fine,

 

Maybe I'll try to print out variables through productcomments.js to see if they have any value at all.

I can't find where the error text is being output from yet.

Link to comment
Share on other sites

update: errors are coming from modules/productcomments/controllers/front/default.php

 

// Validation

if (!Validate::isInt(Tools::getValue('id_product')))

$errors[] = $module_instance->l('ID product is incorrect');

if (!Tools::getValue('title') || !Validate::isGenericName(Tools::getValue('title')))

$errors[] = $module_instance->l('Title is incorrect');

if (!Tools::getValue('content') || !Validate::isMessage(Tools::getValue('content')))

$errors[] = $module_instance->l('Comment is incorrect');

if (!$id_customer && (!Tools::isSubmit('customer_name') || !Tools::getValue('customer_name') || !Validate::isGenericName(Tools::getValue('customer_name'))))

$errors[] = $module_instance->l('Customer name is incorrect');

if (!$this->context->customer->id && !Configuration::get('PRODUCT_COMMENTS_ALLOW_GUESTS'))

$errors[] = $module_instance->l('You must be logged in order to send a comment');

if (!count(Tools::getValue('criterion')))

$errors[] = $module_instance->l('You must give a rating');

 

$product = new Product(Tools::getValue('id_product'));

if (!$product->id)

$errors[] = $module_instance->l('Product not found');

Link to comment
Share on other sites

Found the problem and fixed.

 

In 1.5.5, productcomments/js/productcomments.js has the wrong div name for the

ajax retrival of element values in the form. The data line needs to be the following:

 

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

 

in 1.5.4.1 the div block is #fancybox-content, but that div doesn't exist in 1.5.5

  • Like 3
Link to comment
Share on other sites

Without any more details all I can say is to check your .tpl smarty templates are not serving

a cached version. (you can always put something out of place in the .tpl to see if it renders

or if the cached version is being served.

 

Also, check to see if any theme .tpl may be overriding the default productcomments module.

Link to comment
Share on other sites

RFOX2013 your solution worked perfectly, thanks for posting!!! My reviews were untested until after the update... but I had PS 1.5.4.1 and upgraded to PS 1.5.5.0 before finding that the Reviews module did not work. Followed RFOX2013's solution and no problem.... do clear the cache when finished though. This is the code from LINE 58 in modules/productcomments/js/productcomments.js

 

// 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: $('#new_comment_form 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;
    });
});

 
  • Like 2
Link to comment
Share on other sites

This says

"Module was broken and works now".

so i tried uninstalling the module and reinstalling, just not working for me tried all those methods mentioned above including matching the .js file and .tpl file and always still comes back with same error :-

 

  • Title is incorrect
  • Comment is incorrect
  • Customer name is incorrect
  • Product not found

any help is much appreciated :-)

Link to comment
Share on other sites

Hello all i have one probolem on blocklayer module.

 

I have select subcategory from beck-offcie but font-office not showing subcategory on blocklayer module.

 

Please any ons help me for the  problem.i am using the latest version this is only latest version problem old version working fine.

 

 

Thanks .

Link to comment
Share on other sites

Found the problem and fixed.

 

In 1.5.5, productcomments/js/productcomments.js has the wrong div name for the

ajax retrival of element values in the form. The data line needs to be the following:

 

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

 

in 1.5.4.1 the div block is #fancybox-content, but that div doesn't exist in 1.5.5

That worked for me ! Thanks! i have prestashop 1.5.5

Link to comment
Share on other sites

  • 2 weeks later...

hi

 

i am using Prestashop 1.5.5.0, Product Comments 2.3

 

I am getting these same errors

  • Title is incorrect
  • Comment is incorrect
  • Customer name is incorrect
  • Product not found

 

I have tried -

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

It does not work..

 

Then tried https://github.com/PrestaShop/PrestaShop/commit/9377775eca428c7022abd4bfa301ef83c8b108b8

 

Still does not work. Getting the same errors.

 

Please any suggestions.

 

Thanks.

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

hello thedom,

 

what's going on? you've got blank page? internal server error?

please turn on error reporting:

open config/defines.inc.php
 
find this line
define('_PS_MODE_DEV_', false);
change to look like this:
define('_PS_MODE_DEV_', true);
 
then you will see what's going on (you will see error messages)
Link to comment
Share on other sites

Found the problem and fixed.

 

In 1.5.5, productcomments/js/productcomments.js has the wrong div name for the

ajax retrival of element values in the form. The data line needs to be the following:

 

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

 

in 1.5.4.1 the div block is #fancybox-content, but that div doesn't exist in 1.5.5

 

Worked for me too with v1.5.5 ! Thanks a lot.

Line 63 : replace

data: $('#fancybox-content form').serialize(),

with

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

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

hello thedom,

 

what's going on? you've got blank page? internal server error?

please turn on error reporting:

open config/defines.inc.php

 

find this line

define('_PS_MODE_DEV_', false);

change to look like this:

define('_PS_MODE_DEV_', true);

 

then you will see what's going on (you will see error messages)

Actually, I had a blank page but as I immediately uploaded the backup, I can't report the errors I had, sorry.

Link to comment
Share on other sites

  • 2 weeks later...

I also found the issue in PS 1.5.4.1 but only in Chrome and Firefox, in IE works fine.

 

The problem is when serializing (#fancybox-content form) fields of the comments, the solution that i found is to replace line 63 in the productcomments.js:

 

line 63 productscomments.js:

 

/ /data: $ ('# fancybox-content form'). serialize (),
by this:

 

data: $ ('# fancybox-content input, # fancybox-content textarea, # fancybox-content select'). serialize (),
Now, it works in Chrome and Firefox

 

 

Thank you! Finally a fix for this problem in 1.5.5.0  :)

Link to comment
Share on other sites

  • 2 weeks later...

Hello. After some hours on this problem, ive fixed it on PS 1.5.6.

my problem :

productcomments_url_rewrite is not defined

 

1 - On productcomments.tpl

var productcomment_added_moderation = '{l s='Your comment has been added and will be available once approved by a moderator' mod='productcomments'}';

You do not have a simple quote to declare the variable AND declare the text. So after simple modifications :
 

var productcomment_added_moderation = "{l s='Your comment has been added and will be available once approved by a moderator' mod='productcomments'}";

Fixed

1.2-

var productcomments_url_rewrite = {$productcomments_url_rewriting_activated};

I've just removing simple quote. Why ? Because in this script there is no {literal} so simple quote is not necessary.
 
 
2- Thanks to rfox2013 for solution in productcomment.tpl

now module work fine.

-----------------------------------------------------------------------------------------------------------------------------------
Salut à tous, après quelques heures sur ce problème, j'ai débuggé ce module sur PS 1.5.6.

Mon problème était  :

productcomments_url_rewrite is not defined

 

1 - Dans productcomments.tpl

var productcomment_added_moderation = '{l s='Your comment has been added and will be available once approved by a moderator' mod='productcomments'}';

On peut pas avoir des simple quote pour déclarer la variable ET pour déclarer le texte. Du coup j'ai juste mis des double quotes.

var productcomment_added_moderation = "{l s='Your comment has been added and will be available once approved by a moderator' mod='productcomments'}";

Premier blem Résolu

1.2- bug de la variable

var productcomments_url_rewrite = {$productcomments_url_rewriting_activated};

J'ai juste viré les simple quote. Pourquoi ? Parce que vu qu'il n'y a pas de balise {literal} dans ce script, les quote ne sont pas nécéssaires.

 
 
2- Merci à rfox2013 pour la solution dans le  productcomment.tpl

Maintenant le module fonctionne bien !

  • Like 2
Link to comment
Share on other sites

RFOX2013 your solution worked perfectly, thanks for posting!!! My reviews were untested until after the update... but I had PS 1.5.4.1 and upgraded to PS 1.5.5.0 before finding that the Reviews module did not work. Followed RFOX2013's solution and no problem.... do clear the cache when finished though. This is the code from LINE 58 in modules/productcomments/js/productcomments.js

 

// 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: $('#new_comment_form 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;

    });

});

 

Thank you very much! Its work for http://www.satustore.com

  • Like 2
Link to comment
Share on other sites

  • 3 weeks later...
  • 2 weeks later...

Found the problem and fixed.

 

In 1.5.5, productcomments/js/productcomments.js has the wrong div name for the

ajax retrival of element values in the form. The data line needs to be the following:

 

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

 

in 1.5.4.1 the div block is #fancybox-content, but that div doesn't exist in 1.5.5

 

this helps!thanks

Link to comment
Share on other sites

  • 4 weeks later...

Hi - I've also still got this problem using v1.5.4 in a site under construction

 

I have modified the code re: 

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

What I have noticed is that my productcomments.tpl shows this code:

<div id="new_comment_form">
	<form action="#">
		<h2 class="title">{l s='Write your review' mod='productcomments'}</h2>

yet when I look at the code displayed by the browser the <form> tag is missing: 

<div id="new_comment_form" style="display: block;">
    <h2 class="title">Write your review</h2>

I assume the missing <form> is causing my problem? Any ideas?

 

I'm definitely using the correct .tpl and.js files as they display debug code I have added

Link to comment
Share on other sites

  • 3 weeks later...

Hi - I've also still got this problem using v1.5.4 in a site under construction

 

I have modified the code re: 

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

What I have noticed is that my productcomments.tpl shows this code:

<div id="new_comment_form">
	<form action="#">
		<h2 class="title">{l s='Write your review' mod='productcomments'}</h2>

yet when I look at the code displayed by the browser the <form> tag is missing: 

<div id="new_comment_form" style="display: block;">
    <h2 class="title">Write your review</h2>

I assume the missing <form> is causing my problem? Any ideas?

 

I'm definitely using the correct .tpl and.js files as they display debug code I have added

 

I have corrected this. The Form tag was being removed by the browser as this form was nested within another form.

Link to comment
Share on other sites

  • 4 weeks later...

humm... this kind of problem is caused generaly by theme mistakes..

 

in my case, i found:

 

 

file: themes\THEM_NAME\modules\productcomments\productcomments.tpl

 

search <form> tag..

 

original was

<form action="#">

I changed to

<form  id="id_new_comment_form" action="#" onsubmit="return false;">

I know the "id_new_comment_form" because the file

modules\productcomments\js\productcomments.js

 

is pointing to

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

 

Now, all working fine..

 

PS 1.5.6.0

  • Like 1
Link to comment
Share on other sites

Hello,

 

I think I'm going crazy with this problem.

 

I have installed prestashop 1.5.6.1 and I have always had this issue, however it only happens when the customized template is selected. Products comments works out of the box if I switch to default theme.

 

I'm using a templatemosnter theme compatible with 1.5.X versions but I believe it was developed from 1.5.5.0 engine.

 

This is what I've tried to fix it:

 

https://github.com/PrestaShop/PrestaShop/commit/9377775eca428c7022abd4bfa301ef83c8b108b8

 

I applied the changes in productcomments.tpl (theme folder) since the other files were already fixed.

<!-- Fancybox -->
<div style="display: none;">
    <div id="new_comment_form">
        <form action="#">

Changes I made:

<!-- Fancybox -->
<div style="display: none;">
    <div id="new_comment_form">
        <form id="id_new_comment_form" action="#">

I attach a folder with my .tpl files and productcomments.js as well.

 

I hope you can help me out to get the module working. Any help would be really appreciated.

 

Thanks in advance.

 

Regards.

original.zip

Link to comment
Share on other sites

hey, jesus..

 

<form  id="id_new_comment_form" action="#" onsubmit="return false;">

 

Thank you for your reply!

 

I've changed that line but unfortunately I'm still getting the same errors.

 

http://s494577113.mialojamiento.es/tienda1/es/home/7-dolore-ipsum.html

 

You can check it in this test site (I've upgraded to 1.5.6.2 but it didn't make any difference). I've enabled guest comments if anyone want to reproduce the issue.

 

Regards.

Link to comment
Share on other sites

 

http://s494577113.mialojamiento.es/tienda1/themes/theme818/js/modules/productcomments/js/productcomments.js

data: $('#fancybox-content form').serialize(),

change to

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

 

Thank you very much Vekia! :lol:

 

I thought it must have something to do with the template but I didn't realize productcomments.js was being overiden!

 

Regards!

Link to comment
Share on other sites

I am using prestashop version 1.5.4.1

After installing product comments module it results in below when the products are clicked and directed product description page.

 

Fatal error: Call to undefined method ProductController::getProduct() in /home/content/64/11749364/html/khazanchisilver/modules/productcomments/productcomments.php on line 746

Link to comment
Share on other sites

in other customer website, using 1.5.6.2, the bug cannot be fixed with solutions presented here.

The exact same problem:

Title is incorrect
Comment is incorrect
Customer name is incorrect
Product not found

I tried the same solutions published here, but no solving..

 

 - Have no overriding files

 - The cache and compile cache all clean.

 - Browser refreshed..

 - Tested in different browsers..

 

no way...

 
I'll try some more tests .. 

 

 

 

[LOL]

solved.. 

 

the bug was me haha

 

i made confusion with development and production website URLs..

 

sorry.

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

Hi
I use prestashop 1.5.6.1
I hope someone can help me because I've been looking all over the forum for a solution.

I have tried everything here but it's not working for me. Now I've updated to the Product comment v 2.9.1 and the problem is as follows.

when I write a comment and press send then nothing happens, it seems like (send button) does not work.

I appreciate all the answers
please help me

Link to comment
Share on other sites

Hi

I use prestashop 1.5.6.1

I hope someone can help me because I've been looking all over the forum for a solution.

 

I have tried everything here but it's not working for me. Now I've updated to the Product comment v 2.9.1 and the problem is as follows.

 

when I write a comment and press send then nothing happens, it seems like (send button) does not work.

 

I appreciate all the answers

please help me

any chance to see this problem live? if so, please share url

Link to comment
Share on other sites

comments works well on urolur.se

may i know what is the url to your shop please?

I solved the problem. (my problem was that it did not happen anything when you click on the send button) I did the following operation!

 

uninstalled product comment module, removed it and removed it entirely in ftp, then I installed version 2.3 instead. then I went into productcomment.js and changed lines 64

 

data: $ ('# Fancybox content-form'). serialize ();

 

change to

 

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

 

after I waited 15 minutes and then it worked but I dare not update. hope it helps you too

Link to comment
Share on other sites

  • 2 weeks later...

Hello,

I've tried exactly everything that is in this thread but still can make it work. I've got PS 1.5.6.2 and I've tired with module 2.3 / 2.4 / 2.9 but nothing works. Could you please help me out. The website is live and URL is http://ecigg.nu

 

Thanks in advance!

Link to comment
Share on other sites

in productcomments.js use this code (instead of original)
(http://ecigg.nu/themes/theme794/js/modules/productcomments/js/productcomments.js)

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

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

	$('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: $('#new_comment_form 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;
	});
});

you're welcome :D

Link to comment
Share on other sites

  • 3 months later...

humm... this kind of problem is caused generaly by theme mistakes..

 

in my case, i found:

 

 

file: themes\THEM_NAME\modules\productcomments\productcomments.tpl

 

search <form> tag..

 

original was

<form action="#">

I changed to

<form  id="id_new_comment_form" action="#" onsubmit="return false;">

I know the "id_new_comment_form" because the file

modules\productcomments\js\productcomments.js

 

is pointing to

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

 

Now, all working fine..

 

PS 1.5.6.0

This fixed my issue (custom theme, 1.5.6.2) interestingly only broke once I updated to product comments 3.3.5, but ultimately was a theme error.

Link to comment
Share on other sites

newest versions of product comments uses a little different way to post comments 

this is why it doesnt want to work with new versions

 

Hi Milos, thanks for helping out these users. I believe the product comments module that shipped with 15.6.2 was 2.3. Does the module tell you to update to new versions?

Link to comment
Share on other sites

i just meant that custom themes usually overrides product comments module .tpl file

so when customers upgrade module to new version the old .tpl file will be still used.

 

it causing problems, but problem is not with module, but with theme that is not compatibile with new releases of productcomments module

Link to comment
Share on other sites

×
×
  • Create New...