<?php
//大类列表页生成。  catedetail.html 生成index.html $catedetailStytle="allCateProducts"; ls_syscode writeProPageIndex 611 {ls_behalf}   Click for details 631 $behalf = $mid_pic,  728 $behalf = $sub_pic;  writeIndexPages 1815  _products_catedetail

	$catepronum=cateprototal($cateid);
	$allpages=ceil($catepronum/$PageNum);
	switch($catedetailStytle){
			// 大类下的各中类代表图
			case "catePic":
			
				$mid_pic = "<div class=\"row pro_list\">";
				while($midcate_pic_rows=mysqli_fetch_assoc($midcate_pic_query)){
					if($midcate_pic_rows['catePic'] != null){
						$cateproimgpic=$midcate_pic_rows['midcateFolders']."/".$midcate_pic_rows['catePic'];
						
						$picsrc= $midcate_pic_rows['wholepathpic']; //  21-7-11 换后台，新传图片优先使用，新图为空，使用老图
						$cateproimgpic= $picsrc!=NULL?"../".$picsrc:$cateproimgpic;
						
						$mid_pic .= "<div class=\"col-xs-4\"><div class=\"thumbnail\"><div class=\"img-pic\"><a href=\"".$midcate_pic_rows['midcateFolders']."/".($oldcatepath?$midcate_pic_rows['midcateFolders'].".html":"")."\"><img src=\"".$cateproimgpic."\" name=\"imgs\" alt=\"<translate>".$midcate_pic_rows['midcateName']."</translate>\" title=\"<translate>".$midcate_pic_rows['midcateName']."</translate>\"/></a></div><div class=\"caption \" align='center'><a href=\"".$midcate_pic_rows['midcateFolders']."/".($oldcatepath?$midcate_pic_rows['midcateFolders'].".html":"")."\" ><translate>".$midcate_pic_rows['midcateName']."</translate></a></div></div>
						</div>";
					}
				}
				
				$mid_pic .= "</div>";//echo $mid_pic;
			
			break;

			case "selectProducts":  //类产品
				$addstr=" and AdditionalAttributesClassPro=1 ";
			
			case "allCateProducts":  // 本类全部产品 Click for details
				if($catedetailStytle=="allCateProducts") $addstr=" "; //全部
			
				$mid_pic = "";
				$j=1; $ii=0;
				while($midcate_pic_rows=mysqli_fetch_assoc($midcate_pic_query)){
						$catedetail_sql="SELECT * FROM `ls_products` WHERE `productID`=".$midcate_pic_rows['ID'].$addstr." and enable=1 order by Num ";
						
						$catedetail_query=$opendb->query($catedetail_sql);
						while($catedetail_rows=mysqli_fetch_assoc($catedetail_query)){
							$filenameprodetail1=$catedetail_rows['filename']==""?clearFolder(strtolower(pathProName($catedetail_rows['productName'])))."-".$catedetail_rows['ID'].".html":$catedetail_rows['filename']; //21-7-28
							$filenameprodetail=$midcate_pic_rows['midcateFolders']."/".$filenameprodetail1; //21-7-28
							$cateproimgpic=$midcate_pic_rows['midcateFolders']."/".$SmallFoldersProducts."/".$catedetail_rows['productPic'];
							$picsrc= $catedetail_rows['wholepathpic']; //  21-7-11 换后台，新传图片优先使用，新图为空，使用老图
							$cateproimgpic= $picsrc!=NULL?"../".$picsrc:$cateproimgpic;
							
							
	// 相册 
	/*						$mid_pic .= " 
							<li class=\"prodt\">
							 
							<a class=\"prog\" href=\"".$filenameprodetail."\">
							<img src=\"".$cateproimgpic."\" name=\"imgs\" alt=\"<translate>".$catedetail_rows['productName']."</translate>\" title=\"<translate>".$catedetail_rows['productName']."</translate>\" /></a>
							 
				  <span>
							<a href=\"".$filenameprodetail."\"><translate>".$catedetail_rows['productName']."</translate></a>
							 
							</span> </li>
							";*/
							
	//列表
							$mid_pic.="<img class=\"col-lg-4 col-md-4 col-sm-4 col-xs-12 prolist\" modal=\"zoomImg\" src=\"".$cateproimgpic."\" alt=\"<translate>".$catedetail_rows['productName'].", ".$catedetail_rows['productName']."</translate>\" title=\"<translate>".$catedetail_rows['productName']."</translate>\" width='240' /></a>
					";
					$ii++;  //分页
					if($ii==$PageNum){ 
						if($j==1) $detailsfile=$file;
						//echo $j."--1==".$detailsfile."<br/><br/>"; 
						$index_path2="../".$templates_var."/catedetail.html";	//类详细页面
						$propage=getPagess($prolistfilename.".html",$allpages,$j,true);
						$behalf = $mid_pic;
						//echo "--==".$detailsfile;
						writeIndexPages($index_path2,$catetitle,$cateKeywords,$cateDescription,$url,$banner,$leftcate,$lspro_menu,
						$lsbrief,$procate,$procateid,$propage,$pro,$detailsfile,$echoname,$mynum,$allpages,$detail,$s_cate,$s_news,$s_p_cate,$ls_languages,$s_f_cate,$site_cate_pro,$ls_motif,$ls_revo,$foot,$indicatebar,$behalf,$ls_facebook_twitter2,$translate);						
						$detailsfile=str_replace(".html","-".$j.".html", $file); //str_replace("index.html","indexdetails.html",$file);
						$mid_pic="";
						$ii=0;
						$j++;
					}
					
				}
			}
			$mid_pic .= "";//echo $mid_pic;
			//echo $j."--==".$allpages;
			if($j== $allpages  && $j!=0 ){
					//echo $j."--1==";
					$behalf = $mid_pic;
					$detailsfile=str_replace(".html","-".($j-1).".html", $file); 
					
					$propage=getPagess($prolistfilename.".html",$allpages,$j,true);
					writeIndexPages($index_path2,$catetitle,$cateKeywords,$cateDescription,$url,$banner,$leftcate,$lspro_menu,
				$lsbrief,$procate,$procateid,$propage,$pro,$detailsfile,$echoname,$mynum,$allpages,$detail,$s_cate,$s_news,$s_p_cate,$ls_languages,$s_f_cate,$site_cate_pro,$ls_motif,$ls_revo,$foot,$indicatebar,$behalf,$ls_facebook_twitter2,$translate);						
			
			}
				
			break;
	}
	$mid_pic .= "";//echo $mid_pic;
	
 
			
?>
