docs/api/source-catalog.model.localisation.order_status.html
| 1: | <?php |
| 2: | namespace Opencart\Catalog\Model\Localisation; |
| 3: | /** |
| 4: | * Class OrderStatus |
| 5: | * |
| 6: | * @package Opencart\Catalog\Model\Localisation |
| 7: | */ |
| 8: | class OrderStatus extends \Opencart\System\Engine\Model { |
| 9: | /** |
| 10: | * Get Order Status |
| 11: | * |
| 12: | * @param int $order_status_id |
| 13: | * |
| 14: | * @return array<string, mixed> |
| 15: | */ |
| 16: | public function getOrderStatus(int $order_status_id): array { |
| 17: | $query = $this->db->query("SELECT * FROM " . DB\_PREFIX . "order\_status WHERE order\_status\_id = '" . (int)$order_status_id . "' AND language_id = '" . (int)$this->config->get('config_language_id') . "'"); |
| 18: | |
| 19: | return $query->row; |
| 20: | } |
| 21: | |
| 22: | /** |
| 23: | * Get Order Statuses |
| 24: | * |
| 25: | * @return array<int, array<string, mixed>> |
| 26: | */ |
| 27: | public function getOrderStatuses(): array { |
| 28: | $sql = "SELECT order_status_id, name FROM " . DB\_PREFIX . "order\_status WHERE language\_id = '" . (int)$this->config->get('config_language_id') . "' ORDER BY name"; |
| 29: | |
| 30: | $key = md5($sql); |
| 31: | |
| 32: | $order_status_data = $this->cache->get('order_status.' . $key); |
| 33: | |
| 34: | if (!$order_status_data) { |
| 35: | $query = $this->db->query($sql); |
| 36: | |
| 37: | $order_status_data = $query->rows; |
| 38: | |
| 39: | $this->cache->set('order_status.' . $key, $order_status_data); |
| 40: | } |
| 41: | |
| 42: | return $order_status_data; |
| 43: | } |
| 44: | } |
| 45: | |
OpenCart API API documentation generated by ApiGen dev-master