session_start();
header('Content-Type: text/html; charset=gb2312');
require "../inc/global.php";
require "../inc/function.php";
$pageID = empty($_REQUEST["pageID"])? 30 : $_REQUEST["pageID"];
$select= empty($_REQUEST["select"])? 0 : $_REQUEST["select"];
$type_ID= empty($_REQUEST["type"])? 0 : $_REQUEST["type"];
switch ($select) {
case 0:
$age1="";
break;
case 1:
$age1="and price <= 3000 ";
break;
case 2:
$age1="and price between 3000 and 6000 ";
break;
case 3:
$age1="and price between 6000 and 10000 ";
break;
case 4:
$age1="and price between 10000 and 15000 ";
break;
case 5:
$age1="and price between 15000 and 20000 ";
break;
case 6:
$age1="and price >= 20000 ";
break;
default:
$age1="";
}
$option = "";
$option = $option."";
$option = $option."";
$option = $option."";
$option = $option."";
$option = $option."";
$option = $option."";
$key[0]['name']="音源";
$key[1]['name']="音箱";
$key[2]['name']="放大器";
$key[3]['name']="线材";
$key[4]['name']="其他及附件";
$db=new db();
for ($i=0; $i< 5; $i++) {
$sql="select ID,Title from prog_catalog where FormainID = 10 and Description like '".$key[$i]['name']."' order by ID";
$query = $db->query($sql);
$l=0;
while($forum = $db->fetch_array($query)) {
$type_arry[$i][$l]['ID'] = $forum['ID'];
$type_arry[$i][$l]['Title'] = $forum['Title'];
if ($type_ID == $forum['ID'] ) { $type_ID = $forum['ID'];$type_Title = $forum['Title'];}
$l++;
}
}
if ($type_ID == 0) { $type_ID =$type_arry[0][0]['ID'];$type_Title =$type_arry[0][0]['Title']; }
//echo $type[0][0]['Title'];
//echo $type[1][0]['Title'];
//echo $type_ID;
$sql="select * from cy_product where type='".$type_ID."' and kind=2 and price >0 ".$age1."order by GXMQ , price";
$query = $db->query($sql);
$IP = $db -> check_ip($_SERVER['REMOTE_ADDR']);
$i=0;
while($forum = $db->fetch_array($query)) {
$product[$i]['ID'] = $forum['ID'];
$catalog = $db -> IDtoCatalog($forum['GXMQ']);
$product[$i]['GXMQ'] = $catalog['Title'];
$product[$i]['XLMQ'] = $forum['XLMQ'];
$product[$i]['XKMQ'] = $forum['XKMQ'];//echo $forum['XKMQ']."
";
$product[$i]['XKBM'] = empty($forum['XKBM'])? "" : " ";
if ($IP != "ok") { $price = 0;} else { $price = $forum['price'];}
$product[$i]['unit'] = empty($forum['unit'])? "" : "规格:".$forum['unit'];
$product[$i]['pro_new'] = empty($forum['pro_new'])? "" : "";
$product[$i]['price'] = show_spec($price,$forum['only_spec'],$forum['spec'],$forum['spec_date1'],$forum['spec_date2']);
$product[$i]['shopcard']= ($price == 0 || $_SESSION["checkout"]=="on")? "": "";
$product[$i]['kick'] = $forum['kick'];
$product[$i]['img_path'] = $forum['img_path'];
$product[$i]['photoview'] = $forum['photoview'];
$product[$i]['tao_url'] = empty($forum['tao_url'])? "" : " ";
$i++;
}
//product
$viewdata = array("pageID" => $pageID ,
"siteinfo" => $siteinfo,
"sitename" => $sitename,
"pageID" => $pageID,
"product" => $product,
"option" => $option,
"type_Title" => $type_Title,
"type_ID" => $type_ID,
"type0" => $type_arry[0],
"type1" => $type_arry[1],
"type2" => $type_arry[2],
"type3" => $type_arry[3],
"type4" => $type_arry[4],
);
$tplname= CModel($_SERVER["SCRIPT_NAME"]);
callview($viewdata,$tplname);
?>