Jump to content

[Solved] Problem With Translating Product Comments Module


marhor.hr

Recommended Posts

I'm trying to translate the product comments module.

When writing new product comment, if Title and Comment fields are left empty the error messages for requiered fields is shown.

Well, i can not translate these error messages. They are always shown in english (see attached screencshot).

 

I have translated the "Title is incorrect" and "Comment is incorrect" fields in the backoffice (installed modules translation), but it isn't shown correctly.

 

I'm using Prestashop 1.5.2, Product Comments module is the one that comes with prestashop, v2.3

 

Can anyone help?

post-411875-0-12438500-1357830866_thumb.jpg

Edited by marhor.hr (see edit history)
Link to comment
Share on other sites

  • 2 weeks later...

I have the following error when I try to update the translation of any module. Can you please help?

 

 

 

[PrestaShopException]

Invalid theme "default"

at line 1177 in file controllers/admin/AdminTranslationsController.php

 

1171. if ($existing_theme->directory == $theme)

1172. $theme_exists = true;

1173. if ($theme_exists)

1174. $this->theme_selected = Tools::safeOutput($theme);

1175. else

1176. throw new PrestaShopException(sprintf(Tools::displayError('Invalid theme "%s"'), $theme));

1177. }

1178. else

1179. $this->theme_selected = self::DEFAULT_THEME_NAME;

1180.

1181. // Set the path of selected theme

Link to comment
Share on other sites

Hello Elpatron,

thank You for your answer, but it does not work. I have already translated all the fields into croatian, but output in the form fot these two error messages stays in english (like i described in first post, everything is translated except these error messages which appear when the mandatory fields are left blank).

I suppose this must be a bug in the code, but i can't find it...

Link to comment
Share on other sites

  • 4 weeks later...

@Marhor

 

This is a reply to the initial post of Marhor.

 

I found the location of the text in the newcommentscreen :

//ROOT/modules/productcomments/controllers/front/default.php (around line 78)

 

These texts are not reflected in the admin translations of Prestashop. I haven't figured out how to achieve this but since my shop is only in one language, I have made a change of the text in the page itself (click link for image).

 

If anybody knows the code to have the translation reflected in the backoffice, please reply.

 

For now, maybe this helps you a litttle.

 

Regards,

 

Yoni

 

ps. using 1.5.3

http://www.screencast.com/t/vyG56KBld

  • Like 1
Link to comment
Share on other sites

thanks yonizzz,

i have found the code. Weird thing is, that these strings are reflected in backoffice translations; but are not evaluated when output is generated.

Probably it has to do with problem described in this topic: http://www.prestashop.com/forums/topic/134897-solved-extra-translations-not-in-modules/, but had'nt had the nerves to try it out.

So I've done this:

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

change into $errors[] = Tools::displayError('ID product is incorrect');

 

Now I can translate the string in back office error messages translations, and it is displayed correctly...

 

Bye!

 

PS: i don't know how to change the topic title into "solved" if anyone can explain?

Link to comment
Share on other sites

  • 1 month later...

Hello,

 

because ps parse front/default.php to 'default' source, so we should add this to make work correctly:

 

if (!Validate::isInt(Tools::getValue('id_product')))
	    $errors[] = $module_instance->l('ID product is incorrect', 'default');
    if (!Tools::getValue('title') || !Validate::isGenericName(Tools::getValue('title')))
	    $errors[] = $module_instance->l('Title is incorrect', 'default');
    if (!Tools::getValue('content') || !Validate::isMessage(Tools::getValue('content')))
	    $errors[] = $module_instance->l('Comment is incorrect', 'default');
    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', 'default');
    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', 'default');
    if (!count(Tools::getValue('criterion')))
	    $errors[] = $module_instance->l('You must give a rating', 'default');
    $product = new Product(Tools::getValue('id_product'));
    if (!$product->id)
	    $errors[] = $module_instance->l('Product not found', 'default');

Link to comment
Share on other sites

  • 4 months later...

Please any onse help me prestashop 1.5.5.0

 

 

Title is incorrect

Comment is incorrect

Product not found

 

 

When i write review comment this time showing this problem on prestashop latest version of product comment module.

 

Please any ones help me how can i slvoed this proboem.

 

Thanks jibon

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

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

Hi, how you solved this problem ? I have tried replace

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

with

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

as mentioned in the topic you linked, but this is still not working for me ?

Link to comment
Share on other sites

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...