1: | <?php
2: | namespace Opencart\Catalog\Controller\Account;
3: | /**
4: | * Class Logout
5: | *
6: | * @package Opencart\Catalog\Controller\Account
7: | */
8: | class Logout extends \Opencart\System\Engine\Controller {
9: | /**
10: | * @return void
11: | */
12: | public function index(): void {
13: | if ($this->customer->isLogged()) {
14: | $this->customer->logout();
15: |
16: | unset($this->session->data['customer']);
17: | unset($this->session->data['shipping_address']);
18: | unset($this->session->data['shipping_method']);
19: | unset($this->session->data['shipping_methods']);
20: | unset($this->session->data['payment_address']);
21: | unset($this->session->data['payment_method']);
22: | unset($this->session->data['payment_methods']);
23: | unset($this->session->data['comment']);
24: | unset($this->session->data['order_id']);
25: | unset($this->session->data['coupon']);
26: | unset($this->session->data['reward']);
27: | unset($this->session->data['voucher']);
28: | unset($this->session->data['vouchers']);
29: | unset($this->session->data['customer_token']);
30: |
31: | $this->response->redirect($this->url->link('account/logout', 'language=' . $this->config->get('config_language'), true));
32: | }
33: |
34: | $this->load->language('account/logout');
35: |
36: | $this->document->setTitle($this->language->get('heading_title'));
37: |
38: | $data['breadcrumbs'] = [];
39: |
40: | $data['breadcrumbs'][] = [
41: | 'text' => $this->language->get('text_home'),
42: | 'href' => $this->url->link('common/home', 'language=' . $this->config->get('config_language'))
43: | ];
44: |
45: | $data['breadcrumbs'][] = [
46: | 'text' => $this->language->get('text_account'),
47: | 'href' => $this->url->link('account/account', 'language=' . $this->config->get('config_language'))
48: | ];
49: |
50: | $data['breadcrumbs'][] = [
51: | 'text' => $this->language->get('text_logout'),
52: | 'href' => $this->url->link('account/logout', 'language=' . $this->config->get('config_language'))
53: | ];
54: |
55: | $data['continue'] = $this->url->link('common/home', 'language=' . $this->config->get('config_language'));
56: |
57: | $data['column_left'] = $this->load->controller('common/column_left');
58: | $data['column_right'] = $this->load->controller('common/column_right');
59: | $data['content_top'] = $this->load->controller('common/content_top');
60: | $data['content_bottom'] = $this->load->controller('common/content_bottom');
61: | $data['footer'] = $this->load->controller('common/footer');
62: | $data['header'] = $this->load->controller('common/header');
63: |
64: | $this->response->setOutput($this->load->view('common/success', $data));
65: | }
66: | }
67: |

OpenCart API API documentation generated by ApiGen dev-master