OpenCart 🇺🇦

Схема

protected mixed getForm ( )

Аргументы

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

Описание

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

Исходный код

$this->data['heading_title'] = $this->language->get('heading_title');

$this->data['entry_name'] = $this->language->get('entry_name');
$this->data['entry_attribute_group'] = $this->language->get('entry_attribute_group');
$this->data['entry_sort_order'] = $this->language->get('entry_sort_order');

$this->data['button_save'] = $this->language->get('button_save');
$this->data['button_cancel'] = $this->language->get('button_cancel');

if (isset($this->error['warning'])) {
	$this->data['error_warning'] = $this->error['warning'];
} else {
	$this->data['error_warning'] = '';
}

if (isset($this->error['name'])) {
	$this->data['error_name'] = $this->error['name'];
} else {
	$this->data['error_name'] = array();
}

$url = '';

if (isset($this->request->get['sort'])) {
	$url .= '&sort=' . $this->request->get['sort'];
}

if (isset($this->request->get['order'])) {
	$url .= '&order=' . $this->request->get['order'];
}

if (isset($this->request->get['page'])) {
	$url .= '&page=' . $this->request->get['page'];
}

$this->data['breadcrumbs'] = array();

$this->data['breadcrumbs'][] = array(
	'text'      => $this->language->get('text_home'),
	'href'      => $this->url->link('common/home', 'token=' . $this->session->data['token'], 'SSL'),
	'separator' => false
);

$this->data['breadcrumbs'][] = array(
	'text'      => $this->language->get('heading_title'),
	'href'      => $this->url->link('catalog/attribute', 'token=' . $this->session->data['token'] . $url, 'SSL'),
	'separator' => ' :: '
);

if (!isset($this->request->get['attribute_id'])) {
	$this->data['action'] = $this->url->link('catalog/attribute/insert', 'token=' . $this->session->data['token'] . $url, 'SSL');
} else {
	$this->data['action'] = $this->url->link('catalog/attribute/update', 'token=' . $this->session->data['token'] . '&attribute_id=' . $this->request->get['attribute_id'] . $url, 'SSL');
}

$this->data['cancel'] = $this->url->link('catalog/attribute', 'token=' . $this->session->data['token'] . $url, 'SSL');

if (isset($this->request->get['attribute_id']) && ($this->request->server['REQUEST_METHOD'] != 'POST')) {
	$attribute_info = $this->model_catalog_attribute->getAttribute($this->request->get['attribute_id']);
}

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

$this->data['languages'] = $this->model_localisation_language->getLanguages();

if (isset($this->request->post['attribute_description'])) {
	$this->data['attribute_description'] = $this->request->post['attribute_description'];
} elseif (isset($this->request->get['attribute_id'])) {
	$this->data['attribute_description'] = $this->model_catalog_attribute->getAttributeDescriptions($this->request->get['attribute_id']);
} else {
	$this->data['attribute_description'] = array();
}

if (isset($this->request->post['attribute_group_id'])) {
	$this->data['attribute_group_id'] = $this->request->post['attribute_group_id'];
} elseif (!empty($attribute_info)) {
	$this->data['attribute_group_id'] = $attribute_info['attribute_group_id'];
} else {
	$this->data['attribute_group_id'] = '';
}

$this->load->model('catalog/attribute_group');

$this->data['attribute_groups'] = $this->model_catalog_attribute_group->getAttributeGroups();	

if (isset($this->request->post['sort_order'])) {
	$this->data['sort_order'] = $this->request->post['sort_order'];
} elseif (!empty($attribute_info)) {
	$this->data['sort_order'] = $attribute_info['sort_order'];
} else {
	$this->data['sort_order'] = '';
}

$this->template = 'catalog/attribute_form.tpl';
$this->children = array(
	'common/header',
	'common/footer'
);

$this->response->setOutput($this->render());