?? tcquery.php
字號:
<?php
/*
[插件名稱] 商品套餐檢索 - 替換模版的{#modTcQuery#}
[適用范圍] 檢索頁
[文 件 名] TcQuery.php
[更新時間] 2007/1/10
*/
function TcQuery(){
global $fsql,$msql,$charset,$tbl_shop_con,$tbl_hb,$PagesInfo,$ShowPages,$htmlstr,$CatchOpen;
global $NowCatid,$NowMenuid,$NowFold,$tbl_goodsprop,$MenuInfo,$CONF;
$catid=$NowCatid;
$PSET=PlusSet("modTcQuery");
$shownums=PlusDef($PSET["shownums"],"10");
$ord=PlusDef($PSET["ord"],"id");
$sc=PlusDef($PSET["sc"],"desc");
$cutword=PlusDef($PSET["cutword"],"0");
$target=PlusDef($PSET["target"],"_self");
$tempname=PlusDef($PSET["tempname"],"tpl_shopquery_tc.htm");
$key=$_GET["key"];
$showtj=$_GET["showtj"];
$showremai=$_GET["showremai"];
$shownew=$_GET["shownew"];
$showtejia=$_GET["showtejia"];
$page=$_GET["page"];
//默認貨幣單位
$hbname=$CONF["hbname"];
$hbdanwei=$CONF["hbdanwei"];
$hbcode=$CONF["hbcode"];
$htmlstr=$catid.".html";
//模版解釋
$Temp=LoadTemp(ROOTPATH."templates/".$MenuInfo["skin"]."/".$tempname);
$TempArr=SplitTblTemp($Temp);
$propstr=$TempArr["list"];
$str=$TempArr["start"];
$scl=" menuid='$NowMenuid' and iffb='1' ";
if($catid!="0" && $catid!=""){
$fmdpath=fmpath($catid);
$scl.=" and catpath regexp '$fmdpath' ";
}
if($showtj!="" && $showtj!="all"){
$scl.=" and tj='$showtj' ";
}
if($shownew!="" && $shownew!="all"){
$scl.=" and ifnew='1' ";
}
if($showremai!="" && $showremai!="all"){
$scl.=" and remai='$showremai' ";
}
if($showtejia!="" && $showtejia!="all"){
$scl.=" and tejia='$showtejia' ";
}
if($showremai=="1"){
$ord="cl";
}
if($key!=""){
$scl.=" and (title regexp '$key' or body regexp '$key') ";
}
include(ROOTPATH."includes/func/pages.inc.php");
$pages=new pages;
$totalnums=TblCount($tbl_shop_con,"id",$scl);
$pages->setvar(array("showtj" => $showtj,"showremai" => $showremai,"shownew" => $shownew,"showtejia" => $showtejia,"key" => $key));
$pages->set($shownums,$totalnums);
$pagelimit=$pages->limit();
$fsql->query("select * from $tbl_shop_con where $scl order by $ord $sc limit $pagelimit");
while($fsql->next_record()){
$id=$fsql->f('id');
$catid=$fsql->f('catid');
$catpath=$fsql->f('catpath');
$goodstype=$fsql->f('goodstype');
$body=$fsql->f('body');
$dtime=$fsql->f('dtime');
$title=$fsql->f('title');
$memo=$fsql->f('memo');
$cl=$fsql->f('cl');
$secure=$fsql->f('secure');
$src=$fsql->f('picsmall');
$xtmod=$fsql->f('xtmod');
$stmod=$fsql->f('stmod');
$bn=$fsql->f('bn');
$brand=$fsql->f('brand');
$danwei=$fsql->f('danwei');
$kucun=$fsql->f('kucun');
$cent=$fsql->f('cent');
$pj=$fsql->f('pj');
$kg=$fsql->f('kg');
$price0=$fsql->f('price0');
$price1=$fsql->f('price1');
$price2=$fsql->f('price2');
$price3=$fsql->f('price3');
$price4=$fsql->f('price4');
$price5=$fsql->f('price5');
$price6=$fsql->f('price6');
$price7=$fsql->f('price7');
$price8=$fsql->f('price8');
$price9=$fsql->f('price9');
$price10=$fsql->f('price10');
$price11=$fsql->f('price11');
$price12=$fsql->f('price12');
$prop1=$fsql->f('prop1');
$prop2=$fsql->f('prop2');
$prop3=$fsql->f('prop3');
$prop4=$fsql->f('prop4');
$prop5=$fsql->f('prop5');
$prop6=$fsql->f('prop6');
$prop7=$fsql->f('prop7');
$prop8=$fsql->f('prop8');
$prop9=$fsql->f('prop9');
$prop10=$fsql->f('prop10');
$prop11=$fsql->f('prop11');
$prop12=$fsql->f('prop12');
$prop13=$fsql->f('prop13');
$prop14=$fsql->f('prop14');
$prop15=$fsql->f('prop15');
$prop16=$fsql->f('prop16');
$prop17=$fsql->f('prop17');
$prop18=$fsql->f('prop18');
$prop19=$fsql->f('prop19');
$prop20=$fsql->f('prop20');
$tcall=$fsql->f('tcall');
$i=1;
$msql->query("select * from $tbl_goodsprop where goodstype='$goodstype' order by xuhao");
while($msql->next_record()){
$pn="propname".$i;
$$pn=$msql->f('propname');
$i++;
}
//圖片處理
$autosize="width";
if($src=="" || $src=="http://"){
$src=ROOTPATH."images/nopic.gif";
}else{
if($stmod=="upload"){
$src=ROOTPATH.$src;
$autosize=AutoPicSize($src);
}
}
//評分
$stars=ShowStar($pj);
//價格
$price=NowPrice($id,$goodstype,$price1,$price2,$price3,$price4,$price5,$price6,$price7,$price8,$price9,$price10,$price11,$price12);
$saving=$price0-$price;
if($CatchOpen=="1" && file_exists("../html/".$id.".html")){
$link="../html/".$id.".html";
}else{
$link="../html/?".$id.".html";
}
//購物車鏈接
$cartlink=ROOTPATH."cart.php?step=add&addnums=1&gid=".$id;
//收藏
$addfav=ROOTPATH."member_mygoods.php?step=add&gid=".$id;
//簡介
if($cutword!="0"){$memo=csubstr($memo,0,$cutword,$charset);}
$memo=str_replace("\n","<br>",$memo);
//套餐商品
$TcArrs=TcAll($TempArr,$tcall);
$tcpriceall=$TcArrs["tcpriceall"];
$tcstr=$TcArrs["tcstr"];
$var=array (
'tdwidth' => $tdwidth,
'title' => $title,
'tcpriceall' => $tcpriceall,
'memo' => $memo,
'dtime' => $dtime,
'src' => $src,
'autosize' => $autosize,
'cl' => $cl,
'link' => $link,
'cartlink' => $cartlink,
'addfav' => $addfav,
'target' => $target,
'bn' => $bn,
'kg' => $kg,
'brand' => $brand,
'danwei' => $danwei,
'hbcode' => $hbcode,
'hbdanwei' => $hbdanwei,
'hbname' => $hbname,
'kucun' => $kucun,
'cent' => $cent,
'pj' => $pj,
'stars' => $stars,
'price' => $price,
'price0' => $price0,
'price1' => $price1,
'price2' => $price2,
'price3' => $price3,
'price4' => $price4,
'price5' => $price5,
'price6' => $price6,
'price7' => $price7,
'price8' => $price8,
'price9' => $price9,
'price10' => $price10,
'price11' => $price11,
'price12' => $price12,
'saving' => $saving,
'prop1' => $prop1,
'prop2' => $prop2,
'prop3' => $prop3,
'prop4' => $prop4,
'prop5' => $prop5,
'prop6' => $prop6,
'prop7' => $prop7,
'prop8' => $prop8,
'prop9' => $prop9,
'prop10' => $prop10,
'prop11' => $prop11,
'prop12' => $prop12,
'prop13' => $prop13,
'prop14' => $prop14,
'prop15' => $prop15,
'prop16' => $prop16,
'prop17' => $prop17,
'prop18' => $prop18,
'prop19' => $prop19,
'prop20' => $prop20,
'propname1' => $propname1,
'propname2' => $propname2,
'propname3' => $propname3,
'propname4' => $propname4,
'propname5' => $propname5,
'propname6' => $propname6,
'propname7' => $propname7,
'propname8' => $propname8,
'propname9' => $propname9,
'propname10' => $propname10,
'propname11' => $propname11,
'propname12' => $propname12,
'propname13' => $propname13,
'propname14' => $propname14,
'propname15' => $propname15,
'propname16' => $propname16,
'propname17' => $propname17,
'propname18' => $propname18,
'propname19' => $propname19,
'propname20' => $propname20
);
$goodsstr=str_replace($TempArr["tclist"],$tcstr,$TempArr["list"]);
$str.=ShowTplTemp($goodsstr,$var);
}
$str.=$TempArr["end"];
$PagesInfo=$pages->ShowNow();
$ShowPages=$pages->output(1);
return $str;
}
//套餐內商品讀取
function TcAll($TempArr,$tcall){
global $tsql,$charset,$tbl_shop_con,$CatchOpen;
global $MenuInfo,$CONF;
$tcpriceall=0;
$tcarr=explode("|",$tcall);
for($u=0;$u<sizeof($tcarr)-1;$u++){
if($tcarr[$u]!=""){
$xarr=explode("*",$tcarr[$u]);
if(sizeof($xarr)<=1){
$xid=$tcarr[$u];
$tcnums=1;
}else{
$xid=$xarr[0];
$tcnums=$xarr[1];
}
$tsql->query("select * from $tbl_shop_con where id='$xid'");
if($tsql->next_record()){
$gid=$tsql->f('id');
$menuid=$tsql->f('menuid');
$title=$tsql->f('title');
$memo=$tsql->f('memo');
$src=$tsql->f('picsmall');
$goodstype=$tsql->f('goodstype');
$xtmod=$tsql->f('xtmod');
$bn=$tsql->f('bn');
$brand=$tsql->f('brand');
$danwei=$tsql->f('danwei');
$kucun=$tsql->f('kucun');
$price0=$tsql->f('price0');
$price1=$tsql->f('price1');
$price2=$tsql->f('price2');
$price3=$tsql->f('price3');
$price4=$tsql->f('price4');
$price5=$tsql->f('price5');
$price6=$tsql->f('price6');
$price7=$tsql->f('price7');
$price8=$tsql->f('price8');
$price9=$tsql->f('price9');
$price10=$tsql->f('price10');
$price11=$tsql->f('price11');
$price12=$tsql->f('price12');
//價格
$price=NowPrice($gid,$goodstype,$price1,$price2,$price3,$price4,$price5,$price6,$price7,$price8,$price9,$price10,$price11,$price12);
$tcprice0=$price0*$tcnums;
$tcprice=$price*$tcnums;
$tcprice=number_format($tcprice,2,'.','');
$tcprice0=number_format($tcprice0,2,'.','');
$tcpriceall=$tcpriceall+$tcprice;
//詳情鏈接
$fold=MenuFold($menuid);
if($CatchOpen=="1" && file_exists(ROOTPATH.$fold."/html/".$gid.".html")){
$link=ROOTPATH.$fold."/html/".$gid.".html";
}else{
$link=ROOTPATH.$fold."/html/?".$gid.".html";
}
//簡介
$memo=str_replace("\n","<br>",$memo);
$var=array (
'tcgoods' => $title,
'tcmemo' => $memo,
'tcnums' => $tcnums,
'tcsrc' => $src,
'tcdanwei' => $danwei,
'tclink' => $link,
'tcbn' => $bn,
'tcprice' => $tcprice,
'tcprice0' => $tcprice0
);
$tcstr.=ShowTplTemp($TempArr["tclist"],$var);
}
}
}
$tcpriceall=number_format($tcpriceall,2,'.','');
$TcArrs=array (
'tcstr' => $tcstr,
'tcpriceall' => $tcpriceall
);
return $TcArrs;
}
?>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -