OpenCart 🇺🇦

Схема

public void index ( )

Аргументы

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

Описание

Проверяет, авторизирован ли пользователь. Если нет, то перенаправляет на страницу авторизации:
if (!$this->customer->isLogged()) {
	$this->session->data['redirect'] = $this->url->link('account/account', '', 'SSL');

	$this->redirect($this->url->link('account/login', '', 'SSL'));
}

Подгружает языковой файл страницы:
$this->language->load('account/account');

Устанавливает заголовок (тег title) страницы и добавляет хлебные крошки (breadcrumbs):
$this->document->setTitle($this->language->get('heading_title'));

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

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

$this->data['breadcrumbs'][] = array(
	'text'      => $this->language->get('text_account'),
	'href'      => $this->url->link('account/account', '', 'SSL'),
	'separator' => $this->language->get('text_separator')
);

Если имеется какое-либо информационное сообщение в сессии для показа, то передаем его содержимое в представление:
if (isset($this->session->data['success'])) {
	$this->data['success'] = $this->session->data['success'];

	unset($this->session->data['success']);
} else {
	$this->data['success'] = '';
}

Если в настройках OpenCart включена возможность получать бонусные баллы (Reward Points), то передает в представление ссылку на страницу бонусов:
if ($this->config->get('reward_status')) {
	$this->data['reward'] = $this->url->link('account/reward', '', 'SSL');
} else {
	$this->data['reward'] = '';
}

Если не найден нужный шаблон (account/account) в папке с текущей темой, то ищет такой файл в папке со стандартной темой и выбирает его в качестве загружаемого:
if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/account/account.tpl')) {
	$this->template = $this->config->get('config_template') . '/template/account/account.tpl';
} else {
	$this->template = 'default/template/account/account.tpl';
}

Генерирует содержимое вложенных контроллеров и возвращает полностью сгенерированную страницу:
$this->children = array(
	'common/column_left',
	'common/column_right',
	'common/content_top',
	'common/content_bottom',
	'common/footer',
	'common/header'		
);

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

Исходный код

if (!$this->customer->isLogged()) {
	$this->session->data['redirect'] = $this->url->link('account/account', '', 'SSL');

	$this->redirect($this->url->link('account/login', '', 'SSL'));
}

$this->language->load('account/account');

$this->document->setTitle($this->language->get('heading_title'));

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

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

$this->data['breadcrumbs'][] = array(
	'text'      => $this->language->get('text_account'),
	'href'      => $this->url->link('account/account', '', 'SSL'),
	'separator' => $this->language->get('text_separator')
);

if (isset($this->session->data['success'])) {
	$this->data['success'] = $this->session->data['success'];

	unset($this->session->data['success']);
} else {
	$this->data['success'] = '';
}

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

$this->data['text_my_account'] = $this->language->get('text_my_account');
$this->data['text_my_orders'] = $this->language->get('text_my_orders');
$this->data['text_my_newsletter'] = $this->language->get('text_my_newsletter');
$this->data['text_edit'] = $this->language->get('text_edit');
$this->data['text_password'] = $this->language->get('text_password');
$this->data['text_address'] = $this->language->get('text_address');
$this->data['text_wishlist'] = $this->language->get('text_wishlist');
$this->data['text_order'] = $this->language->get('text_order');
$this->data['text_download'] = $this->language->get('text_download');
$this->data['text_reward'] = $this->language->get('text_reward');
$this->data['text_return'] = $this->language->get('text_return');
$this->data['text_transaction'] = $this->language->get('text_transaction');
$this->data['text_newsletter'] = $this->language->get('text_newsletter');
$this->data['text_recurring'] = $this->language->get('text_recurring');

$this->data['edit'] = $this->url->link('account/edit', '', 'SSL');
$this->data['password'] = $this->url->link('account/password', '', 'SSL');
$this->data['address'] = $this->url->link('account/address', '', 'SSL');
$this->data['wishlist'] = $this->url->link('account/wishlist');
$this->data['order'] = $this->url->link('account/order', '', 'SSL');
$this->data['download'] = $this->url->link('account/download', '', 'SSL');
$this->data['return'] = $this->url->link('account/return', '', 'SSL');
$this->data['transaction'] = $this->url->link('account/transaction', '', 'SSL');
$this->data['newsletter'] = $this->url->link('account/newsletter', '', 'SSL');
$this->data['recurring'] = $this->url->link('account/recurring', '', 'SSL');

if ($this->config->get('reward_status')) {
	$this->data['reward'] = $this->url->link('account/reward', '', 'SSL');
} else {
	$this->data['reward'] = '';
}

if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/account/account.tpl')) {
	$this->template = $this->config->get('config_template') . '/template/account/account.tpl';
} else {
	$this->template = 'default/template/account/account.tpl';
}

$this->children = array(
	'common/column_left',
	'common/column_right',
	'common/content_top',
	'common/content_bottom',
	'common/footer',
	'common/header'		
);

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