OpenCart 🇺🇦

Схема

protected mixed getForm ( )

Аргументы

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

Описание

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

Исходный код

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

$this->data['text_choose'] = $this->language->get('text_choose');
$this->data['text_select'] = $this->language->get('text_select');
$this->data['text_radio'] = $this->language->get('text_radio');
$this->data['text_checkbox'] = $this->language->get('text_checkbox');
$this->data['text_image'] = $this->language->get('text_image');
$this->data['text_input'] = $this->language->get('text_input');
$this->data['text_text'] = $this->language->get('text_text');
$this->data['text_textarea'] = $this->language->get('text_textarea');
$this->data['text_file'] = $this->language->get('text_file');
$this->data['text_date'] = $this->language->get('text_date');
$this->data['text_datetime'] = $this->language->get('text_datetime');
$this->data['text_time'] = $this->language->get('text_time');
$this->data['text_image_manager'] = $this->language->get('text_image_manager');
$this->data['text_browse'] = $this->language->get('text_browse');
$this->data['text_clear'] = $this->language->get('text_clear');	

$this->data['entry_name'] = $this->language->get('entry_name');
$this->data['entry_type'] = $this->language->get('entry_type');
$this->data['entry_option_value'] = $this->language->get('entry_option_value');
$this->data['entry_image'] = $this->language->get('entry_image');
$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');
$this->data['button_add_option_value'] = $this->language->get('button_add_option_value');
$this->data['button_remove'] = $this->language->get('button_remove');

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();
}	

if (isset($this->error['option_value'])) {
	$this->data['error_option_value'] = $this->error['option_value'];
} else {
	$this->data['error_option_value'] = 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/option', 'token=' . $this->session->data['token'] . $url, 'SSL'),
	'separator' => ' :: '
);

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

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

if (isset($this->request->get['option_id']) && ($this->request->server['REQUEST_METHOD'] != 'POST')) {
	$option_info = $this->model_catalog_option->getOption($this->request->get['option_id']);
}

$this->data['token'] = $this->session->data['token'];

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

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

if (isset($this->request->post['option_description'])) {
	$this->data['option_description'] = $this->request->post['option_description'];
} elseif (isset($this->request->get['option_id'])) {
	$this->data['option_description'] = $this->model_catalog_option->getOptionDescriptions($this->request->get['option_id']);
} else {
	$this->data['option_description'] = array();
}	

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

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

if (isset($this->request->post['option_value'])) {
	$option_values = $this->request->post['option_value'];
} elseif (isset($this->request->get['option_id'])) {
	$option_values = $this->model_catalog_option->getOptionValueDescriptions($this->request->get['option_id']);
} else {
	$option_values = array();
}

$this->load->model('tool/image');

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

foreach ($option_values as $option_value) {
	if ($option_value['image'] && file_exists(DIR_IMAGE . $option_value['image'])) {
		$image = $option_value['image'];
	} else {
		$image = 'no_image.jpg';
	}

	$this->data['option_values'][] = array(
		'option_value_id'          => $option_value['option_value_id'],
		'option_value_description' => $option_value['option_value_description'],
		'image'                    => $image,
		'thumb'                    => $this->model_tool_image->resize($image, 100, 100),
		'sort_order'               => $option_value['sort_order']
	);
}

$this->data['no_image'] = $this->model_tool_image->resize('no_image.jpg', 100, 100);

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

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