OpenCart 🇺🇦

Схема

protected mixed validateForm ( )

Аргументы

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

Описание

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

Исходный код

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['address_1']) < 3) || (utf8_strlen($this->request->post['address_1']) > 128)) {
	$this->error['address_1'] = $this->language->get('error_address_1');
}

if ((utf8_strlen($this->request->post['city']) < 2) || (utf8_strlen($this->request->post['city']) > 128)) {
	$this->error['city'] = $this->language->get('error_city');
}

$this->load->model('localisation/country');

$country_info = $this->model_localisation_country->getCountry($this->request->post['country_id']);

if ($country_info) {
	if ($country_info['postcode_required'] && (utf8_strlen($this->request->post['postcode']) < 2) || (utf8_strlen($this->request->post['postcode']) > 10)) {
		$this->error['postcode'] = $this->language->get('error_postcode');
	}

	// VAT Validation
	$this->load->helper('vat');

	if ($this->config->get('config_vat') && !empty($this->request->post['tax_id']) && (vat_validation($country_info['iso_code_2'], $this->request->post['tax_id']) == 'invalid')) {
		$this->error['tax_id'] = $this->language->get('error_vat');
	}		
}

if ($this->request->post['country_id'] == '') {
	$this->error['country'] = $this->language->get('error_country');
}

if (!isset($this->request->post['zone_id']) || $this->request->post['zone_id'] == '') {
	$this->error['zone'] = $this->language->get('error_zone');
}

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