/**
* Get model id
*
* @param $brand_id int
* @param $model_name string
* @return int
*/
protected function getModelId($brand_id, $model_name)
{
$query = $this->db->query("
SELECT model_id FROM " . DB_PREFIX . "auto_models WHERE brand_id = '" . (int) $brand_id . "' AND model_name = '" . $this->db->escape($model_name) . "'
");
if (empty($query->row)) {
$this->db->query(
"INSERT INTO " . DB_PREFIX . "auto_models (brand_id, model_name, model_start, model_end, active) VALUES ('" . (int) $brand_id . "', '" . $this->db->escape($model_name) . "', 0, 0, 1)"
);
$model_id = (int) $this->db->getLastId();
} else {
$model_id = (int) $query->row['model_id'];
}
return $model_id;
}
/**
* Get modification id
*
* @param $model_id int
* @param $modif_name string
* @return int
*/
protected function getModificationId($model_id, $modif_name)
{
$query = $this->db->query("
SELECT modif_id FROM " . DB_PREFIX . "auto_modifications WHERE model_id = '" . (int) $model_id . "' AND modif_name = '" . $this->db->escape($modif_name) . "'
");
if (empty($query->row)) {
$this->db->query("
INSERT INTO oc_auto_modifications
(model_id, modif_name, active) 155 строка VALUES ('" . (int) $model_id . "', '" . $this->db->escape($modif_name) . "', 1)
");
$modif_id = (int) $this->db->getLastId();
} else {
$modif_id = (int) $query->row['modif_id'];
}
return $modif_id;
}