$sql = "select cat_name from " .$GLOBALS['ecs']->table('category'). " where cat_id = '$cat_id'";
$cat_name = $GLOBALS['db']->getOne($sql);
$message = "";
foreach ($fittings AS $val)
{
$brand_name = $GLOBALS['db']->getOne("SELECT brand_name FROM ".$GLOBALS['ecs']->table('brand')." WHERE brand_id = '$val' LIMIT 1");
$sql = "select fb_id from " .$GLOBALS['ecs']->table('floor_content'). " where brand_id = '$val' AND filename = '$filename' AND id = '$cat_id' AND region = '$region' AND theme = '$curr_template'";
if(!$GLOBALS['db']->getOne($sql)){
$sql = "INSERT INTO " . $GLOBALS['ecs']->table('floor_content') .
$sql = "DELETE FROM ".$GLOBALS['ecs']->table('floor_content')." WHERE filename = '$filename' AND theme = '$theme' AND id = '$cat_id' AND region = '$region'";
function get_floor_content($curr_template,$filename,$id=0,$region='')
{
$where=" where 1 ";
if(!empty($id))
{
$where.=" and id='$id'";
}
if(!empty($region))
{
$where.=" and region='$region'";
}
$sql="select * from ".$GLOBALS['ecs']->table('floor_content').$where." and filename='$filename' and theme='$curr_template'";
$row=$GLOBALS['db']->getAll($sql);
return $row;
}
function get_floors($curr_template,$filename)
{
$sql="select * from ".$GLOBALS['ecs']->table('floor_content')." where filename='$filename' and theme='$curr_template' group by filename,theme,id";
$row = $GLOBALS['db']->getAll($sql);
foreach($row as $key=>$val)
{
$row[$key]['brand_list']=$GLOBALS['db']->getAll("select b.brand_id, b.brand_name from ".$GLOBALS['ecs']->table('brand') ." AS b, ".
$GLOBALS['ecs']->table('floor_content') ." AS fc ".
" where fc.filename = '" .$val['filename']. "' AND theme = '" .$val['theme']. "' AND id = '" .$val['id']. "' AND id = '" .$val['id']. "' AND region = '" .$val['region']. "' AND b.brand_id = fc.brand_id");
$row[$key]['cat_name']=$GLOBALS['db']->getOne("select cat_name from ".$GLOBALS['ecs']->table('category')." where cat_id='$val[id]' limit 1");
}
return $row;
}
function get_template($curr_template,$filename,$region)
{
$sql="select region,id from ".$GLOBALS['ecs']->table('template')." where filename='$filename' and theme='$curr_template' and region='$region'";
$res = $GLOBALS['db']->getAll($sql);
$arr = array();
foreach($res as $key=> $row){
$arr[$key] = $row;
$arr[$key]['cat_name'] = $GLOBALS['db']->getOne("select cat_name from ".$GLOBALS['ecs']->table('category')." where cat_id = '" .$row['id']. "' limit 1");
"FROM " . $GLOBALS['ecs']->table('brand') . "AS b ".
" LEFT JOIN " . $GLOBALS['ecs']->table('goods') . " AS g ON g.brand_id = b.brand_id AND g.user_id = 0 AND g.is_on_sale = 1 AND g.is_alone_sale = 1 AND g.is_delete = 0 ".
" LEFT JOIN " . $GLOBALS['ecs']->table('goods_cat') . " AS gc ON g.goods_id = gc.goods_id " .
" WHERE $where AND b.is_show = 1 " .
"GROUP BY b.brand_id HAVING goods_num > 0 ORDER BY b.sort_order, b.brand_id ASC";
"FROM " . $GLOBALS['ecs']->table('brand') . "AS b ".
" LEFT JOIN " . $GLOBALS['ecs']->table('link_brand') . "AS lb ON lb.brand_id = b.brand_id ".
" LEFT JOIN " . $GLOBALS['ecs']->table('merchants_shop_brand') . "AS msb ON msb.bid = lb.bid AND msb.audit_status = 1 ".
" LEFT JOIN " . $GLOBALS['ecs']->table('goods') . " AS g ON g.brand_id = msb.bid AND g.user_id > 0 AND g.is_on_sale = 1 AND g.is_alone_sale = 1 AND g.is_delete = 0 ".
" LEFT JOIN " . $GLOBALS['ecs']->table('goods_cat') . " AS gc ON g.goods_id = gc.goods_id " .
" WHERE $where AND b.is_show = 1 " .
"GROUP BY b.brand_id HAVING goods_num > 0 ORDER BY b.sort_order, b.brand_id ASC";