OpenCart 🇺🇦

Схема

public mixed addInformation ( $data )

Аргументы

Аргумент Возможный тип Описание
$data

Описание

Метод пока еще не документирован.

Исходный код

$this->db->query("INSERT INTO " . DB_PREFIX . "information SET sort_order = '" . (int)$data['sort_order'] . "', bottom = '" . (isset($data['bottom']) ? (int)$data['bottom'] : 0) . "', status = '" . (int)$data['status'] . "'");

$information_id = $this->db->getLastId(); 

foreach ($data['information_description'] as $language_id => $value) {
	$this->db->query("INSERT INTO " . DB_PREFIX . "information_description SET information_id = '" . (int)$information_id . "', language_id = '" . (int)$language_id . "', title = '" . $this->db->escape($value['title']) . "', description = '" . $this->db->escape($value['description']) . "'");
}

if (isset($data['information_store'])) {
	foreach ($data['information_store'] as $store_id) {
		$this->db->query("INSERT INTO " . DB_PREFIX . "information_to_store SET information_id = '" . (int)$information_id . "', store_id = '" . (int)$store_id . "'");
	}
}

if (isset($data['information_layout'])) {
	foreach ($data['information_layout'] as $store_id => $layout) {
		if ($layout) {
			$this->db->query("INSERT INTO " . DB_PREFIX . "information_to_layout SET information_id = '" . (int)$information_id . "', store_id = '" . (int)$store_id . "', layout_id = '" . (int)$layout['layout_id'] . "'");
		}
	}
}

if ($data['keyword']) {
	$this->db->query("INSERT INTO " . DB_PREFIX . "url_alias SET query = 'information_id=" . (int)$information_id . "', keyword = '" . $this->db->escape($data['keyword']) . "'");
}

$this->cache->delete('information');