Jump to content

product comments - how to make mendatory fields, optional?


haimbilia

Recommended Posts

hi everyone.

i want to let my users the option to add an empty review on a product so i will only get the stars review.

in other words: making the subject and comment fields optional.

by default it is mendatory, as you can see in the image i added.

 

i use prestashop 1.6.1.4 with the default bootstrap theme

this is my site: techbit.co.il

 

thank you, and sorry if i done anything wrong.

post-979469-0-42562900-1459676027_thumb.jpg

Link to comment
Share on other sites

you need to remove the validation code from the controller of the page

/modules/productcomments/controllers/front/default.php

 

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');

You may also consider to use our Agile Product Review modules, it has more features, for example send email to customer ask for reviews after several of order (configurable).

  • Like 1
Link to comment
Share on other sites

thank you very much for the help. very appreciated!  :) 

i did what you said. but now if i post an empty review, the submit button will do nothing (no response).

it does let me submit it without a title but it wants at least one character in the comment field.

Link to comment
Share on other sites

ok so i managed to do it by putting &nbsp inside the <textarea> tags, so the field has a space value when you open it.

so if anyone want to do it just go to productcomments.tpl and search for this:

<textarea id="content" name="content"></textarea>

and replace it with this:

<textarea id="content" name="content">&nbsp</textarea>

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