1: | <?php
2: | namespace Opencart\Catalog\Controller\Account;
3: | /**
4: | * Class Account
5: | *
6: | * @package Opencart\Catalog\Controller\Account
7: | */
8: | class Account extends \Opencart\System\Engine\Controller {
9: | /**
10: | * @return void
11: | */
12: | public function index(): void {
13: | $this->load->language('account/account');
14: |
15: | if (!$this->customer->isLogged() || (!isset($this->request->get['customer_token']) || !isset($this->session->data['customer_token']) || ($this->request->get['customer_token'] != $this->session->data['customer_token']))) {
16: | $this->session->data['redirect'] = $this->url->link('account/account', 'language=' . $this->config->get('config_language'));
17: |
18: | $this->response->redirect($this->url->link('account/login', 'language=' . $this->config->get('config_language'), true));
19: | }
20: |
21: | $this->document->setTitle($this->language->get('heading_title'));
22: |
23: | $data['breadcrumbs'] = [];
24: |
25: | $data['breadcrumbs'][] = [
26: | 'text' => $this->language->get('text_home'),
27: | 'href' => $this->url->link('common/home', 'language=' . $this->config->get('config_language'))
28: | ];
29: |
30: | $data['breadcrumbs'][] = [
31: | 'text' => $this->language->get('text_account'),
32: | 'href' => $this->url->link('account/account', 'language=' . $this->config->get('config_language') . '&customer_token=' . $this->session->data['customer_token'])
33: | ];
34: |
35: | if (isset($this->session->data['success'])) {
36: | $data['success'] = $this->session->data['success'];
37: |
38: | unset($this->session->data['success']);
39: | } else {
40: | $data['success'] = '';
41: | }
42: |
43: | $data['edit'] = $this->url->link('account/edit', 'language=' . $this->config->get('config_language') . '&customer_token=' . $this->session->data['customer_token']);
44: | $data['password'] = $this->url->link('account/password', 'language=' . $this->config->get('config_language') . '&customer_token=' . $this->session->data['customer_token']);
45: | $data['address'] = $this->url->link('account/address', 'language=' . $this->config->get('config_language') . '&customer_token=' . $this->session->data['customer_token']);
46: | $data['payment_method'] = $this->url->link('account/payment_method', 'language=' . $this->config->get('config_language') . '&customer_token=' . $this->session->data['customer_token']);
47: | $data['wishlist'] = $this->url->link('account/wishlist', 'language=' . $this->config->get('config_language') . '&customer_token=' . $this->session->data['customer_token']);
48: | $data['order'] = $this->url->link('account/order', 'language=' . $this->config->get('config_language') . '&customer_token=' . $this->session->data['customer_token']);
49: | $data['subscription'] = $this->url->link('account/subscription', 'language=' . $this->config->get('config_language') . '&customer_token=' . $this->session->data['customer_token']);
50: | $data['download'] = $this->url->link('account/download', 'language=' . $this->config->get('config_language') . '&customer_token=' . $this->session->data['customer_token']);
51: |
52: | if ($this->config->get('total_reward_status')) {
53: | $data['reward'] = $this->url->link('account/reward', 'language=' . $this->config->get('config_language') . '&customer_token=' . $this->session->data['customer_token']);
54: | } else {
55: | $data['reward'] = '';
56: | }
57: |
58: | $data['return'] = $this->url->link('account/returns', 'language=' . $this->config->get('config_language') . '&customer_token=' . $this->session->data['customer_token']);
59: | $data['transaction'] = $this->url->link('account/transaction', 'language=' . $this->config->get('config_language') . '&customer_token=' . $this->session->data['customer_token']);
60: | $data['newsletter'] = $this->url->link('account/newsletter', 'language=' . $this->config->get('config_language') . '&customer_token=' . $this->session->data['customer_token']);
61: |
62: | if ($this->config->get('config_affiliate_status')) {
63: | $data['affiliate'] = $this->url->link('account/affiliate', 'language=' . $this->config->get('config_language') . '&customer_token=' . $this->session->data['customer_token']);
64: |
65: | $this->load->model('account/affiliate');
66: |
67: | $affiliate_info = $this->model_account_affiliate->getAffiliate($this->customer->getId());
68: |
69: | if ($affiliate_info) {
70: | $data['tracking'] = $this->url->link('account/tracking', 'language=' . $this->config->get('config_language') . '&customer_token=' . $this->session->data['customer_token']);
71: | } else {
72: | $data['tracking'] = '';
73: | }
74: | } else {
75: | $data['affiliate'] = '';
76: | }
77: |
78: | $data['column_left'] = $this->load->controller('common/column_left');
79: | $data['column_right'] = $this->load->controller('common/column_right');
80: | $data['content_top'] = $this->load->controller('common/content_top');
81: | $data['content_bottom'] = $this->load->controller('common/content_bottom');
82: | $data['footer'] = $this->load->controller('common/footer');
83: | $data['header'] = $this->load->controller('common/header');
84: |
85: | $this->response->setOutput($this->load->view('account/account', $data));
86: | }
87: | }
88: |

OpenCart API API documentation generated by ApiGen dev-master