1: | <?php
|
2: | namespace Opencart\Catalog\Controller\Common;
|
3: | |
4: | |
5: | |
6: | |
7: |
|
8: | class Header extends \Opencart\System\Engine\Controller {
|
9: | |
10: | |
11: |
|
12: | public function index(): string {
|
13: |
|
14: | $data['analytics'] = [];
|
15: |
|
16: | if (!$this->config->get('config_cookie_id') || (isset($this->request->cookie['policy']) && $this->request->cookie['policy'])) {
|
17: | $this->load->model('setting/extension');
|
18: |
|
19: | $analytics = $this->model_setting_extension->getExtensionsByType('analytics');
|
20: |
|
21: | foreach ($analytics as $analytic) {
|
22: | if ($this->config->get('analytics_' . $analytic['code'] . '_status')) {
|
23: | $data['analytics'][] = $this->load->controller('extension/' . $analytic['extension'] . '/analytics/' . $analytic['code'], $this->config->get('analytics_' . $analytic['code'] . '_status'));
|
24: | }
|
25: | }
|
26: | }
|
27: |
|
28: | $data['lang'] = $this->language->get('code');
|
29: | $data['direction'] = $this->language->get('direction');
|
30: |
|
31: | $data['title'] = $this->document->getTitle();
|
32: | $data['base'] = $this->config->get('config_url');
|
33: | $data['description'] = $this->document->getDescription();
|
34: | $data['keywords'] = $this->document->getKeywords();
|
35: |
|
36: |
|
37: | $data['bootstrap'] = 'catalog/view/stylesheet/bootstrap.css';
|
38: | $data['icons'] = 'catalog/view/stylesheet/fonts/fontawesome/css/all.min.css';
|
39: | $data['stylesheet'] = 'catalog/view/stylesheet/stylesheet.css';
|
40: |
|
41: |
|
42: | $data['jquery'] = 'catalog/view/javascript/jquery/jquery-3.7.1.min.js';
|
43: |
|
44: | $data['links'] = $this->document->getLinks();
|
45: | $data['styles'] = $this->document->getStyles();
|
46: | $data['scripts'] = $this->document->getScripts('header');
|
47: |
|
48: | $data['name'] = $this->config->get('config_name');
|
49: |
|
50: | if (is_file(DIR_IMAGE . $this->config->get('config_logo'))) {
|
51: | $data['logo'] = $this->config->get('config_url') . 'image/' . $this->config->get('config_logo');
|
52: | } else {
|
53: | $data['logo'] = '';
|
54: | }
|
55: |
|
56: | $this->load->language('common/header');
|
57: |
|
58: |
|
59: | if ($this->customer->isLogged()) {
|
60: | $this->load->model('account/wishlist');
|
61: |
|
62: | $data['text_wishlist'] = sprintf($this->language->get('text_wishlist'), $this->model_account_wishlist->getTotalWishlist($this->customer->getId()));
|
63: | } else {
|
64: | $data['text_wishlist'] = sprintf($this->language->get('text_wishlist'), (isset($this->session->data['wishlist']) ? count($this->session->data['wishlist']) : 0));
|
65: | }
|
66: |
|
67: | $data['home'] = $this->url->link('common/home', 'language=' . $this->config->get('config_language'));
|
68: | $data['wishlist'] = $this->url->link('account/wishlist', 'language=' . $this->config->get('config_language') . (isset($this->session->data['customer_token']) ? '&customer_token=' . $this->session->data['customer_token'] : ''));
|
69: | $data['logged'] = $this->customer->isLogged();
|
70: |
|
71: | if (!$this->customer->isLogged()) {
|
72: | $data['register'] = $this->url->link('account/register', 'language=' . $this->config->get('config_language'));
|
73: | $data['login'] = $this->url->link('account/login', 'language=' . $this->config->get('config_language'));
|
74: | } else {
|
75: | $data['account'] = $this->url->link('account/account', 'language=' . $this->config->get('config_language') . '&customer_token=' . $this->session->data['customer_token']);
|
76: | $data['order'] = $this->url->link('account/order', 'language=' . $this->config->get('config_language') . '&customer_token=' . $this->session->data['customer_token']);
|
77: | $data['transaction'] = $this->url->link('account/transaction', 'language=' . $this->config->get('config_language') . '&customer_token=' . $this->session->data['customer_token']);
|
78: | $data['download'] = $this->url->link('account/download', 'language=' . $this->config->get('config_language') . '&customer_token=' . $this->session->data['customer_token']);
|
79: | $data['logout'] = $this->url->link('account/logout', 'language=' . $this->config->get('config_language'));
|
80: | }
|
81: |
|
82: | $data['shopping_cart'] = $this->url->link('checkout/cart', 'language=' . $this->config->get('config_language'));
|
83: | $data['checkout'] = $this->url->link('checkout/checkout', 'language=' . $this->config->get('config_language'));
|
84: | $data['contact'] = $this->url->link('information/contact', 'language=' . $this->config->get('config_language'));
|
85: | $data['telephone'] = $this->config->get('config_telephone');
|
86: |
|
87: | $data['language'] = $this->load->controller('common/language');
|
88: | $data['currency'] = $this->load->controller('common/currency');
|
89: | $data['search'] = $this->load->controller('common/search');
|
90: | $data['cart'] = $this->load->controller('common/cart');
|
91: | $data['menu'] = $this->load->controller('common/menu');
|
92: |
|
93: | return $this->load->view('common/header', $data);
|
94: | }
|
95: | }
|
96: | |