opencart 3,如何从管理员编辑命令中将必填字段编辑为非必填字段?

问题描述

我需要将必填字段编辑为不需要,例如lastname,county .. 在管理员/销售/编辑订单中 和编辑客户/编辑客户?

我已编辑admin / view / template / sale / order_form.tpl 并删除必填

但是它仍然不起作用

有人知道该怎么做吗?

非常感谢您。

解决方法

当您在admin中编辑订单时,您将请求发送到catalog / controller / api / customer以保存有关客户的信息。在这个经过验证的文件中。

请参阅一部分验证目录/控制器/ api /客户内部字段的代码:

if ((utf8_strlen(trim($this->request->post['firstname'])) < 1) || (utf8_strlen(trim($this->request->post['firstname'])) > 32)) {
    $json['error']['firstname'] = $this->language->get('error_firstname');
}

if ((utf8_strlen(trim($this->request->post['lastname'])) < 1) || (utf8_strlen(trim($this->request->post['lastname'])) > 32)) {
    $json['error']['lastname'] = $this->language->get('error_lastname');
}

if ((utf8_strlen($this->request->post['email']) > 96) || (!filter_var($this->request->post['email'],FILTER_VALIDATE_EMAIL))) {
    $json['error']['email'] = $this->language->get('error_email');
}

if ((utf8_strlen($this->request->post['telephone']) < 3) || (utf8_strlen($this->request->post['telephone']) > 32)) {
    $json['error']['telephone'] = $this->language->get('error_telephone');
}

       

如果您不想使用姓氏字段,请仅删除其验证。

这仅适用于“销售”编辑中的客户信息。