D
D
DeniSidorenko2020-04-30 06:11:38
opencart
DeniSidorenko, 2020-04-30 06:11:38

Where can I edit required fields for a product?

Good afternoon, for the product there is a mandatory field Article. If it is empty, the item is not saved. How can I remove required from this field. Looked in admin/controller but nothing there!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
L
lazuren, 2020-05-02
@DeniSidorenko

for the product there is a mandatory field Article.

Initially, in OpenCart, the required field is not Article, but Model.
Looked in admin/controller but nothing there!

In the function validateForm()from the controller, admin/controller/catalog/product.php comment out these lines:
if ((utf8_strlen($this->request->post['model']) < 1) || (utf8_strlen($this->request->post['model']) > 64)) {
      $this->error['model'] = $this->language->get('error_model');
    }

And to remove the red asterisk next to the field, you need to admin/view/template/catalog/recurring_form.twig
remove the required class in the file.
<div class="form-group required">
                <label class="col-sm-2 control-label" for="input-model">{{ entry_model }}</label>
                <div class="col-sm-10">
                  <input type="text" name="model" value="{{ model }}" placeholder="{{ entry_model }}" id="input-model" class="form-control"/>
                  {% if error_model %}
                    <div class="text-danger">{{ error_model }}</div>
                  {% endif %}</div>
              </div>

L
Leonid, 2020-04-30
@caballero

\admin\controller\catalog\product.php
there check on the model field

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question