1: | <?php
2: | namespace Opencart\Catalog\Model\Localisation;
3: | /**
4: | * Class SubscriptionStatus
5: | *
6: | * @package Opencart\Catalog\Model\Localisation
7: | */
8: | class SubscriptionStatus extends \Opencart\System\Engine\Model {
9: | /**
10: | * Get Subscription Status
11: | *
12: | * @param int $subscription_status_id
13: | *
14: | * @return array<string, mixed>
15: | */
16: | public function getSubscriptionStatus(int $subscription_status_id): array {
17: | $query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "subscription_status` WHERE `subscription_status_id` = '" . (int)$subscription_status_id . "' AND `language_id` = '" . (int)$this->config->get('config_language_id') . "'");
18: |
19: | return $query->row;
20: | }
21: |
22: | /**
23: | * Get Subscription Statuses
24: | *
25: | * @return array<int, array<string, mixed>>
26: | */
27: | public function getSubscriptionStatuses(): array {
28: | $sql = "SELECT `subscription_status_id`, `name` FROM `" . DB_PREFIX . "subscription_status` WHERE `language_id` = '" . (int)$this->config->get('config_language_id') . "' ORDER BY `name`";
29: |
30: | $key = md5($sql);
31: |
32: | $subscription_status_data = $this->cache->get('subscription_status.' . $key);
33: |
34: | if (!$subscription_status_data) {
35: | $query = $this->db->query($sql);
36: |
37: | $subscription_status_data = $query->rows;
38: |
39: | $this->cache->set('subscription_status.' . $key, $subscription_status_data);
40: | }
41: |
42: | return $subscription_status_data;
43: | }
44: | }
45: |

OpenCart API API documentation generated by ApiGen dev-master