OpenCart 🇺🇦

Класс ModelSettingSetting extends Model { ... }

Тип Возвр. Описание
public mixed getSetting ( $group, $store_id = 0 )
Исходный код метода:
$data = array(); 

$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "setting WHERE store_id = '" . (int)$store_id . "' AND `group` = '" . $this->db->escape($group) . "'");

foreach ($query->rows as $result) {
	if (!$result['serialized']) {
		$data[$result['key']] = $result['value'];
	} else {
		$data[$result['key']] = unserialize($result['value']);
	}
}

return $data;
public mixed editSetting ( $group, $data, $store_id = 0 )
Исходный код метода:
$this->db->query("DELETE FROM " . DB_PREFIX . "setting WHERE store_id = '" . (int)$store_id . "' AND `group` = '" . $this->db->escape($group) . "'");

foreach ($data as $key => $value) {
	if (!is_array($value)) {
		$this->db->query("INSERT INTO " . DB_PREFIX . "setting SET store_id = '" . (int)$store_id . "', `group` = '" . $this->db->escape($group) . "', `key` = '" . $this->db->escape($key) . "', `value` = '" . $this->db->escape($value) . "'");
	} else {
		$this->db->query("INSERT INTO " . DB_PREFIX . "setting SET store_id = '" . (int)$store_id . "', `group` = '" . $this->db->escape($group) . "', `key` = '" . $this->db->escape($key) . "', `value` = '" . $this->db->escape(serialize($value)) . "', serialized = '1'");
	}
}
public mixed deleteSetting ( $group, $store_id = 0 )
Исходный код метода:
$this->db->query("DELETE FROM " . DB_PREFIX . "setting WHERE store_id = '" . (int)$store_id . "' AND `group` = '" . $this->db->escape($group) . "'");
public mixed editSettingValue ( $group = '', $key = '', $value = '', $store_id = 0 )
Исходный код метода:
if (!is_array($value)) {
	$this->db->query("UPDATE " . DB_PREFIX . "setting SET `value` = '" . $this->db->escape($value) . "' WHERE `group` = '" . $this->db->escape($group) . "' AND `key` = '" . $this->db->escape($key) . "' AND store_id = '" . (int)$store_id . "'");
} else {
	$this->db->query("UPDATE " . DB_PREFIX . "setting SET `value` = '" . $this->db->escape(serialize($value)) . "' WHERE `group` = '" . $this->db->escape($group) . "' AND `key` = '" . $this->db->escape($key) . "' AND store_id = '" . (int)$store_id . "', serialized = '1'");
}

Связанные классы:

Название класса Роль
class DB { ... } Компонент Db используется в данном классе

Комментарии