1: <?php
2: namespace Opencart\Catalog\Controller\Common;
3: /**
4: * Class Footer
5: *
6: * @package Opencart\Catalog\Controller\Common
7: */
8: class Footer extends \Opencart\System\Engine\Controller {
9: /**
10: * @return string
11: */
12: public function index(): string {
13: $this->load->language('common/footer');
14:
15: $this->load->model('cms/article');
16:
17: $article_total = $this->model_cms_article->getTotalArticles();
18:
19: if ($article_total) {
20: $data['blog'] = $this->url->link('cms/blog', 'language=' . $this->config->get('config_language'));
21: } else {
22: $data['blog'] = '';
23: }
24:
25: $data['informations'] = [];
26:
27: $this->load->model('catalog/information');
28:
29: $results = $this->model_catalog_information->getInformations();
30:
31: foreach ($results as $result) {
32: $data['informations'][] = [
33: 'title' => $result['title'],
34: 'href' => $this->url->link('information/information', 'language=' . $this->config->get('config_language') . '&information_id=' . $result['information_id'])
35: ];
36: }
37:
38: $data['contact'] = $this->url->link('information/contact', 'language=' . $this->config->get('config_language'));
39: $data['return'] = $this->url->link('account/returns.add', 'language=' . $this->config->get('config_language'));
40:
41: if ($this->config->get('config_gdpr_id')) {
42: $data['gdpr'] = $this->url->link('information/gdpr', 'language=' . $this->config->get('config_language'));
43: } else {
44: $data['gdpr'] = '';
45: }
46:
47: $data['sitemap'] = $this->url->link('information/sitemap', 'language=' . $this->config->get('config_language'));
48: $data['manufacturer'] = $this->url->link('product/manufacturer', 'language=' . $this->config->get('config_language'));
49: $data['voucher'] = $this->url->link('checkout/voucher', 'language=' . $this->config->get('config_language'));
50:
51: if ($this->config->get('config_affiliate_status')) {
52: $data['affiliate'] = $this->url->link('account/affiliate', 'language=' . $this->config->get('config_language') . (isset($this->session->data['customer_token']) ? '&customer_token=' . $this->session->data['customer_token'] : ''));
53: } else {
54: $data['affiliate'] = '';
55: }
56:
57: $data['special'] = $this->url->link('product/special', 'language=' . $this->config->get('config_language') . (isset($this->session->data['customer_token']) ? '&customer_token=' . $this->session->data['customer_token'] : ''));
58: $data['account'] = $this->url->link('account/account', 'language=' . $this->config->get('config_language') . (isset($this->session->data['customer_token']) ? '&customer_token=' . $this->session->data['customer_token'] : ''));
59: $data['order'] = $this->url->link('account/order', 'language=' . $this->config->get('config_language') . (isset($this->session->data['customer_token']) ? '&customer_token=' . $this->session->data['customer_token'] : ''));
60: $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'] : ''));
61: $data['newsletter'] = $this->url->link('account/newsletter', 'language=' . $this->config->get('config_language') . (isset($this->session->data['customer_token']) ? '&customer_token=' . $this->session->data['customer_token'] : ''));
62:
63: $data['powered'] = sprintf($this->language->get('text_powered'), $this->config->get('config_name'), date('Y', time()));
64:
65: // Who's Online
66: if ($this->config->get('config_customer_online')) {
67: $this->load->model('tool/online');
68:
69: if (isset($this->request->server['HTTP_X_REAL_IP'])) {
70: $ip = $this->request->server['HTTP_X_REAL_IP'];
71: } elseif (isset($this->request->server['REMOTE_ADDR'])) {
72: $ip = $this->request->server['REMOTE_ADDR'];
73: } else {
74: $ip = '';
75: }
76:
77: if (isset($this->request->server['HTTP_HOST']) && isset($this->request->server['REQUEST_URI'])) {
78: $url = ($this->request->server['HTTPS'] ? 'https://' : 'http://') . $this->request->server['HTTP_HOST'] . $this->request->server['REQUEST_URI'];
79: } else {
80: $url = '';
81: }
82:
83: if (isset($this->request->server['HTTP_REFERER'])) {
84: $referer = $this->request->server['HTTP_REFERER'];
85: } else {
86: $referer = '';
87: }
88:
89: $this->model_tool_online->addOnline($ip, $this->customer->getId(), $url, $referer);
90: }
91:
92: $data['bootstrap'] = 'catalog/view/javascript/bootstrap/js/bootstrap.bundle.min.js';
93:
94: $data['scripts'] = $this->document->getScripts('footer');
95:
96: $data['cookie'] = $this->load->controller('common/cookie');
97:
98: return $this->load->view('common/footer', $data);
99: }
100: }
101: