ction classes_list(){
global $table_pre, $lang_a_product;
$classes = '';
$query_1 = $this->db->query("select classes_id, title, parent_id, sort_order from ".$table_pre."classes where parent_id = '0' and classes='1' order by sort_order, title");
while ($category_1= $this->db->fetch_array($query_1)) {
$classes.='<ul><li><b>'.$category_1['title'].'</b> - <a href="admin.php?act=products&type=add&classes_id='.$category_1['classes_id'].'">['.$lang_a_product['add_product'].']</a> <a href="admin.php?act=products&type=search_result&classes_id='.$category_1['classes_id'].'">['.$lang_a_product['look_product'].']</a>';
$query_2 = $this->db->query("select classes_id, title, parent_id, sort_order from ".$table_pre."classes where parent_id = '".$category_1['classes_id']."' and classes='2' order by sort_order, title");
while ($category_2= $this->db->fetch_array($query_2)) {
$classes.='<ul><li><b>'.$category_2['title'].'</b> - <a href="admin.php?act=products&type=add&classes_id='.$category_2['classes_id'].'">['.$lang_a_product['add_product'].']</a> <a href="admin.php?act=products&type=search_result&classes_id='.$category_2['classes_id'].'">['.$lang_a_product['look_product'].']</a>';
$query_3 = $this->db->query("select classes_id, title, parent_id, sort_order from ".$table_pre."classes where parent_id = '".$category_2['classes_id']."' and classes='3' order by sort_order, title");
while ($category_3= $this->db->fetch_array($query_3)) {
$classes.='<ul><li><b>'.$category_3['title'].'</b> - <a href="admin.php?act=products&type=add&classes_id='.$category_3['classes_id'].'">['.$lang_a_product['add_product'].']</a> <a href="admin.php?act=products&type=search_result&classes_id='.$category_3['classes_id'].'">['.$lang_a_product['look_product'].']</a>';
$query_4 = $this->db->query("select classes_id, title, parent_id, sort_order from ".$table_pre."classes where parent_id = '".$category_3['classes_id']."' and classes='4' order by sort_order, title");
while ($category_4= $this->db->fetch_array($query_4)) {
$classes.='<ul><li><b>'.$category_4['title'].'</b> - <a href="admin.php?act=products&type=add&classes_id='.$category_4['classes_id'].'">['.$lang_a_product['add_product'].']</a> <a href="admin.php?act=products&type=search_result&classes_id='.$category_4['classes_id'].'">['.$lang_a_product['look_product'].']</a>';
$classes.='</ul>';
}
$classes.='</ul>';
}
$classes.='</ul>';
}
$classes.='</ul>';
}
return $classes;
}
function add($sql_data_array){
global $table_pre, $timestamp;
$this->db->perform($table_pre."products", $sql_data_array);
$this->product_id = $this->db->insert_id();
$sql_data_array = array(
'pid' => $this->product_id,
'cid' => (int)$sql_data_array['classes_id'],
'dateadd' => $timestamp,
);
$this->db->perform($table_pre."ptoc", $sql_data_array);
}
function update_common($sql_data_array){
global $table_pre, $timestamp;
$this->db->perform($table_pre."products", $sql_data_array,'update',"products_id='".(int)$this->product_id . "'");
}
function update_classes($newcid = '', $delete = ''){
global $table_pre, $timestamp;
if($newcid != ''){
$get_one = $this->db->get_one("select count(*) as count from ".$table_pre."ptoc where pid='".$this->product_id."' and cid='".$newcid."'");
if($get_one['count'] < 1){
$sql_data_array = array(
'pid' => $this->product_id,