⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tcprop.php

📁 推荐的一本书!!!!建议看 !!!!!!!!!
💻 PHP
字号:
<?php

/*
	[插件名称] 商品套餐参数列表 - 替换模版标签{#modTcProp#}
	[适用范围] 频道详情页
	[文 件 名] TcProp.php
	[更新时间] 2007/3/5
*/

function TcProp(){

	global $msql,$fsql,$tbl_goodsprop,$tbl_goodsprop_list,$tbl_shop_con,$NowMenuid,$ArrayShopDetail,$MenuInfo;

	$PSET=PlusSet("modTcProp");

	$tempname=PlusDef($PSET["tempname"],"tpl_goodsprop_tc.htm");

	$goodstype=$ArrayShopDetail["goodstype"];
	$tcall=$ArrayShopDetail["tcall"];
	$fsall=$ArrayShopDetail["fsall"];


	//模版解释
	$Temp=LoadTemp(ROOTPATH."templates/".$MenuInfo["skin"]."/".$tempname);
	$TempArr=SplitTblTemp($Temp);

	$str=$TempArr["start"];




	$i=1;
	$msql->query("select * from $tbl_goodsprop where goodstype='$goodstype' order by xuhao");
	while($msql->next_record()){
		$propid=$msql->f('id');
		$propname=$msql->f('propname');
		$proptype=$msql->f('proptype');
		$ifsel=$msql->f('ifsel');
		$ifdetail=$msql->f('ifdetail');
		$pn="prop".$i;

		if($proptype=="list"){

			if($ifsel=="1"){
				$pnlist="";
				$arr=explode(",",$ArrayShopDetail[$pn]);
				$arrnums=sizeof($arr);

				if($arrnums<=0){
					$pnlist="<option value='".$ArrayShopDetail[$pn]."'>".$ArrayShopDetail[$pn]."</option>";
				
				}else{
					for($m=0;$m<sizeof($arr);$m++){
						$pnlist.="<option value='".$arr[$m]."'>".$arr[$m]."</option>";
					}
				}

				
				$pstr=str_replace("{#propname#}",$propname,$TempArr["menu"]);
				$pstr=str_replace("{#pnlist#}",$pnlist,$pstr);
				$pstr=str_replace("{#pn#}",$pn,$pstr);
			
			}else{

				$pstr=str_replace("{#propname#}",$propname,$TempArr["list"]);
				$pstr=str_replace("{#prop#}",$ArrayShopDetail[$pn],$pstr);
			}

		}else{
			$pstr=str_replace("{#propname#}",$propname,$TempArr["list"]);
			$pstr=str_replace("{#prop#}",$ArrayShopDetail[$pn],$pstr);
		}

		if($ifdetail=="1"){
			$str.=$pstr;
		}

	$i++;
	}

	$str.=$TempArr["end"];

	
	//套餐内商品

	$TcArrs=TcAll($TempArr,$tcall);
	$tcpriceall=$TcArrs["tcpriceall"];
	$tcstr=$TcArrs["tcstr"];

	$str=str_replace($TempArr["tclist"],$tcstr,$str);
	$str=str_replace("{#tcpriceall#}",$tcpriceall,$str);

	
	//附属商品

	$fsstr=FushuAll($TempArr,$fsall);
	$str=str_replace($TempArr["fslist"],$fsstr,$str);


	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');
					$goodstype=$tsql->f('goodstype');
					$title=$tsql->f('title');
					$memo=$tsql->f('memo');
					$src=$tsql->f('picsmall');
					$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 + -