1: | <?php
2: | namespace Opencart\Catalog\Model\Catalog;
3: | /**
4: | * Class Information
5: | *
6: | * @package Opencart\Catalog\Model\Catalog
7: | */
8: | class Information extends \Opencart\System\Engine\Model {
9: | /**
10: | * Get Information
11: | *
12: | * @param int $information_id
13: | *
14: | * @return array<string, mixed>
15: | */
16: | public function getInformation(int $information_id): array {
17: | $query = $this->db->query("SELECT DISTINCT * FROM `" . DB_PREFIX . "information` `i` LEFT JOIN `" . DB_PREFIX . "information_description` `id` ON (`i`.`information_id` = `id`.`information_id`) LEFT JOIN `" . DB_PREFIX . "information_to_store` `i2s` ON (`i`.`information_id` = `i2s`.`information_id`) WHERE `i`.`information_id` = '" . (int)$information_id . "' AND `id`.`language_id` = '" . (int)$this->config->get('config_language_id') . "' AND `i2s`.`store_id` = '" . (int)$this->config->get('config_store_id') . "' AND `i`.`status` = '1'");
18: |
19: | return $query->row;
20: | }
21: |
22: | /**
23: | * Get Information(s)
24: | *
25: | * @return array<int, array<string, mixed>>
26: | */
27: | public function getInformations(): array {
28: | $query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "information` `i` LEFT JOIN `" . DB_PREFIX . "information_description` `id` ON (`i`.`information_id` = `id`.`information_id`) LEFT JOIN `" . DB_PREFIX . "information_to_store` `i2s` ON (`i`.`information_id` = `i2s`.`information_id`) WHERE `id`.`language_id` = '" . (int)$this->config->get('config_language_id') . "' AND `i2s`.`store_id` = '" . (int)$this->config->get('config_store_id') . "' AND `i`.`status` = '1' ORDER BY `i`.`sort_order`, LCASE(`id`.`title`) ASC");
29: |
30: | return $query->rows;
31: | }
32: |
33: | /**
34: | * Get Layout ID
35: | *
36: | * @param int $information_id
37: | *
38: | * @return int
39: | */
40: | public function getLayoutId(int $information_id): int {
41: | $query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "information_to_layout` WHERE `information_id` = '" . (int)$information_id . "' AND `store_id` = '" . (int)$this->config->get('config_store_id') . "'");
42: |
43: | if ($query->num_rows) {
44: | return (int)$query->row['layout_id'];
45: | } else {
46: | return 0;
47: | }
48: | }
49: | }
50: |

OpenCart API API documentation generated by ApiGen dev-master