Search code examples
opencartopencart-3

How to make the review field optional in OC 3.x?


enter image description here

I need the name and the rating fields to be required and the review field to be optional. I'm using OC 3.x with Journal theme, it is possible from the panel or should I modify the MVC arhitecture to achieve this? Some users told me that they want to rate but without typing any text/review. I'm thinking if I modify the form group from required to optional from the view, it will give an error because the database will expect also the review. So there is any way from the admin panel?


Solution

  • No, you will not be able to do this through the admin panel. But you can do it like this: Remove condition from controller catalog/controller/product/product.php in method write()

    if ((utf8_strlen($this->request->post['text']) < 25) || (utf8_strlen($this->request->post['text']) > 1000)) {
      $json['error'] = $this->language->get('error_text');
    }
    

    You don't need to do anything in the database because this field is optional in the schema.