OpenCart 🇺🇦

Схема

protected mixed validate ( )

Аргументы

Аргумент Возможный тип Описание
У метода нет аргументов

Описание

Метод пока еще не документирован.

Исходный код

if (!$this->request->post['order_id']) {
	$this->error['order_id'] = $this->language->get('error_order_id');
}

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

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

if ((utf8_strlen($this->request->post['email']) > 96) || !preg_match('/^[^\@]+@.*\.[a-z]{2,6}$/i', $this->request->post['email'])) {
	$this->error['email'] = $this->language->get('error_email');
}

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

if ((utf8_strlen($this->request->post['product']) < 1) || (utf8_strlen($this->request->post['product']) > 255)) {
	$this->error['product'] = $this->language->get('error_product');
}	

if ((utf8_strlen($this->request->post['model']) < 1) || (utf8_strlen($this->request->post['model']) > 64)) {
	$this->error['model'] = $this->language->get('error_model');
}							

if (empty($this->request->post['return_reason_id'])) {
	$this->error['reason'] = $this->language->get('error_reason');
}	

if (empty($this->session->data['captcha']) || ($this->session->data['captcha'] != $this->request->post['captcha'])) {
	$this->error['captcha'] = $this->language->get('error_captcha');
}

if ($this->config->get('config_return_id')) {
	$this->load->model('catalog/information');

	$information_info = $this->model_catalog_information->getInformation($this->config->get('config_return_id'));

	if ($information_info && !isset($this->request->post['agree'])) {
		$this->error['warning'] = sprintf($this->language->get('error_agree'), $information_info['title']);
	}
}

if (!$this->error) {
	return true;
} else {
	return false;
}