@TommyEL

Ошибка при редактировании заказа Opencart 3.0.2?

Добрый день, подскажите как исправить ошибку. В админке при редактировании заказа вылазит ошибка

storage/modification/catalog/controller/api/customer.php on line 81
или
catalog/controller/api/customer.php on line 81

{"error": {"custom_field1":\u041e\...........\u0433\u0433) required!", "custom_field2":" ...................... required!"}}

Полагаю, что мы создали кастомные поля для заполнения клиентом и теперь система ругается на них, вот код со строчки 81

}  elseif (($custom_field['type'] == 'text') && !empty($custom_field['validation']) && !filter_var($this->request->post['custom_field'][$custom_field['location']][$custom_field['custom_field_id']], FILTER_VALIDATE_REGEXP, array('options' => array('regexp' => $custom_field['validation'])))) {
						$json['error']['custom_field' . $custom_field['custom_field_id']] = sprintf($this->language->get('error_custom_field'), $custom_field['name']); 
					}


  • Вопрос задан
  • 103 просмотра
Пригласить эксперта
Ответы на вопрос 1
@TommyEL Автор вопроса
Нашел решение проблемы на форме здесь

в файле \catalog\controller\api\customer.php
строки от 69 по 77 заменить на:

foreach ($custom_fields as $custom_field) {
                if ($custom_field['location'] == 'account') {
                    foreach ($this->request->post['custom_field'] as $posted_key => $posted_value) {
                        if ((int)$posted_key == (int)$custom_field['custom_field_id']) {
                            if (empty($posted_value) && $custom_field['required']) {
                                $json['error']['custom_field' . $custom_field['custom_field_id']] = sprintf($this->language->get('error_custom_field'), $custom_field['name']);
                            } elseif ((html_entity_decode(trim(strtolower($custom_field['type'])), ENT_QUOTES, 'UTF-8') == 'text') && !empty($custom_field['validation']) && !filter_var($posted_value, FILTER_VALIDATE_REGEXP, array('options' => array('regexp' => $custom_field['validation'])))) {
                                $json['error']['custom_field' . $custom_field['custom_field_id']] = sprintf($this->language->get('error_custom_field'), $custom_field['name']);
                            }
                        }
                    }
                }
            }
Ответ написан
Комментировать
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы
16 мая 2024, в 23:36
200000 руб./за проект
16 мая 2024, в 23:10
12000 руб./за проект