1: | <?php
|
2: | namespace Opencart\Catalog\Controller\Information;
|
3: | |
4: | |
5: | |
6: | |
7: |
|
8: | class Information extends \Opencart\System\Engine\Controller {
|
9: | |
10: | |
11: |
|
12: | public function index(): ?\Opencart\System\Engine\Action {
|
13: | $this->load->language('information/information');
|
14: |
|
15: | if (isset($this->request->get['information_id'])) {
|
16: | $information_id = (int)$this->request->get['information_id'];
|
17: | } else {
|
18: | $information_id = 0;
|
19: | }
|
20: |
|
21: | $this->load->model('catalog/information');
|
22: |
|
23: | $information_info = $this->model_catalog_information->getInformation($information_id);
|
24: |
|
25: | if ($information_info) {
|
26: | $this->document->setTitle($information_info['meta_title']);
|
27: | $this->document->setDescription($information_info['meta_description']);
|
28: | $this->document->setKeywords($information_info['meta_keyword']);
|
29: |
|
30: | $data['breadcrumbs'] = [];
|
31: |
|
32: | $data['breadcrumbs'][] = [
|
33: | 'text' => $this->language->get('text_home'),
|
34: | 'href' => $this->url->link('common/home', 'language=' . $this->config->get('config_language'))
|
35: | ];
|
36: |
|
37: | $data['breadcrumbs'][] = [
|
38: | 'text' => $information_info['title'],
|
39: | 'href' => $this->url->link('information/information', 'language=' . $this->config->get('config_language') . '&information_id=' . $information_id)
|
40: | ];
|
41: |
|
42: | $data['heading_title'] = $information_info['title'];
|
43: |
|
44: | $data['description'] = html_entity_decode($information_info['description'], ENT_QUOTES, 'UTF-8');
|
45: |
|
46: | $data['continue'] = $this->url->link('common/home', 'language=' . $this->config->get('config_language'));
|
47: |
|
48: | $data['column_left'] = $this->load->controller('common/column_left');
|
49: | $data['column_right'] = $this->load->controller('common/column_right');
|
50: | $data['content_top'] = $this->load->controller('common/content_top');
|
51: | $data['content_bottom'] = $this->load->controller('common/content_bottom');
|
52: | $data['footer'] = $this->load->controller('common/footer');
|
53: | $data['header'] = $this->load->controller('common/header');
|
54: |
|
55: | $this->response->setOutput($this->load->view('information/information', $data));
|
56: | } else {
|
57: | return new \Opencart\System\Engine\Action('error/not_found');
|
58: | }
|
59: |
|
60: | return null;
|
61: | }
|
62: |
|
63: | |
64: | |
65: | |
66: | |
67: |
|
68: | public function info(): void {
|
69: | if (isset($this->request->get['information_id'])) {
|
70: | $information_id = (int)$this->request->get['information_id'];
|
71: | } else {
|
72: | $information_id = 0;
|
73: | }
|
74: |
|
75: | $this->load->model('catalog/information');
|
76: |
|
77: | $information_info = $this->model_catalog_information->getInformation($information_id);
|
78: |
|
79: | if ($information_info) {
|
80: | $data['title'] = $information_info['title'];
|
81: | $data['description'] = html_entity_decode($information_info['description'], ENT_QUOTES, 'UTF-8');
|
82: |
|
83: | $this->response->addHeader('X-Robots-Tag: noindex');
|
84: | $this->response->setOutput($this->load->view('information/information_info', $data));
|
85: | }
|
86: | }
|
87: | }
|
88: | |