PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Sunday, October 16, 2022

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

 October 16, 2022     opencart, opencart-3     No comments   

Issue

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.



Answered By - Harvey Dent
Answer Checked By - Candace Johnson (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing