<?php
// 产品侧边栏菜单 536 public {ls_p_cate} ， 支持产品在菜单类别下列出，如存在文件 _menu_product_side_pro.php。

	$s_p_cate="<ul class=\"menu-listside\">";
	$x = $p_num;
	$y = 0;
	$oldcatename= $oldpropath? "index.html" :"";
	while($p_cate_rows=mysqli_fetch_assoc($p_cate_query))
	{
	  $detailsfile = "";
	  $y++;
	  $p_midcate_sql="select * from ls_products where cateName is null and subcateName is null and subcateFolders is null and subcateBrief is null and subcateID is null and productPic is null and productItemNo is null and productName is null and productSpecification is null and productID is null and enable=1 and midcateID=".$p_cate_rows['ID']." order by Num asc";
	  $p_midcate_query=$opendb->query($p_midcate_sql);
	  $p_midcate_num=mysqli_num_rows($p_midcate_query);
	  
	  $detailsfile=$ifcatelink?"../".$p_cate_rows['cateFolders']."/".($oldcatepath?$p_cate_rows['cateFolders'].".html":$menucatename):"javascript:void(01)"; //22-4-19 ".$p_cate_rows['cateFolders'].".html
	  $detailsfile2="../".$templates_var."/catedetail.html";	  
	  
	  if($p_midcate_num==0)//大类
	  {
		//$s_p_cate.="&nbsp;<img src='../Templates/images/cate.gif' border='0'> \n";
		//$s_p_cate.="\n<dt>".$p_cate_rows['cateName']."</dt>";
		 // $s_p_cate.="<li class=\"list-group-item side-pro-list-item\"><a href='../".$p_cate_rows['cateFolders']."/".$p_cate_rows['cateFolders'].".html'> <translate>".$p_cate_rows['cateName']."</translate></a></li>";
		$myproid=$p_cate_rows['ID'];
		$cateurl1= catepro1($myproid);//大类下1个产品
		$detailsfile=$cateurl1!=">1"?$cateurl1:$detailsfile; //1个产品跳过列表页
		 
		$s_p_cate.="<li class=\"list side-pro-list-item icon-play3\"><a class=\"dalei_said\"> <translate>".$p_cate_rows['cateName']."</translate></a>";
		// $s_p_cate.="\n <div class=\"cate_list\">\n"; //大类菜单样式，div css:cate_list
		  $mycatefolder="../".$p_cate_rows['cateFolders']."/"; //2021-4-15
		  //产品列表			
		  //echo  "bott大类无中类-".$mycatefolder;
		   if($ifmenupro)file_exists("_menu_product_side_pro.php")?include "_menu_product_side_pro.php":""; 
		  $s_p_cate.="</li>";
	  } 
	  else//大类中类
	  {
		//$s_p_cate.="&nbsp;<img src='../Templates/".$templates_var."/images/cate.gif' border='0'> \n";  //大类引导图
		if(file_exists($detailsfile2)){
			//".$detailsfile."
			$s_p_cate.="\n<li class=\"list side-pro-list-item icon-play3\"><a class=\"dalei_said\"> <translate>".$p_cate_rows['cateName']."</translate></a><ul class=\"items\" id=\"content".$p_cate_rows['ID']."\" >";
		}else{
			$s_p_cate.="\n<li class=\"list-group-item side-pro-list-item\"><a href='javascript:void(0)' onclick=\"turnit(".$p_cate_rows['ID'].",".$p_cate_rows['ID'].");this.href=this.href+'?menuId='+".$p_cate_rows['ID']."+'&cate='+".$p_cate_rows['ID'].";\" > <translate>".$p_cate_rows['cateName']."</translate></a><ul class=\"items\" id=\"content".$p_cate_rows['ID']."\" >";
		}
		//？ 不应该有$s_p_cate.="\n <div class=\"cate_list\">\n";
		while($p_midcate_rows=mysqli_fetch_assoc($p_midcate_query))
		{
			$p_subcate_sql="select * from ls_products where midcateName is null and cateName is null and cateFolders is null and catePagePic is null and catePagePicWidth is null and catePagePicHeight is null and cateBrief is null and productPic is null and productItemNo is null and productName is null and productSpecification is null and productID is null and enable=1 and subcateID=".$p_midcate_rows['ID']." order by Num asc";
			$p_subcate_query=$opendb->query($p_subcate_sql);
			$p_subcate_num=mysqli_num_rows($p_subcate_query);
			$mdetailsfile="../".$p_cate_rows['cateFolders']."/".$p_midcate_rows['midcateFolders']."/".($oldcatepath?$p_midcate_rows['midcateFolders'].".html":$menucatename); //22-4-19	".$p_midcate_rows['midcateName'].".html
			//$s_p_cate.="<div class=\"midcate_list\">"; //中类菜单样式
			$myproid=$p_midcate_rows['ID'];
		    $cateurl1= catepro1($myproid);//中类下1个产品
		    $mdetailsfile=$cateurl1!=">1"?$cateurl1:$mdetailsfile; //1个产品跳过列表页
			if($p_subcate_num==0)//没小类
			{
				$s_p_cate.="\n<li  class=\"list-group-item side-pro-list-item\"><a href='".$mdetailsfile."' onclick=\"turnit(".$p_cate_rows['ID'].",".$p_cate_rows['ID'].");this.href=this.href+'?menuId='+".$p_cate_rows['ID']."+'&cate='+".$p_cate_rows['ID'].";\"> <translate>".$p_midcate_rows['midcateName']."</translate></a>"; //".$p_midcate_rows['midcateFolders'].".html
				$mycatefolder="../".$p_cate_rows['cateFolders']."/".$p_midcate_rows['midcateFolders']."/";	
				//产品列表		
		 		 if($ifmenupro)file_exists("_menu_product_side_pro.php")?include "_menu_product_side_pro.php":""; 
		  		$s_p_cate.="</li>";
			}
			else//有小类
			{
			//$s_p_cate.="&nbsp;<img src='../Templates/".$templates_var."/images/midcate.gif' border='0'> \n"; //中类引导图
			if(file_exists($detailsfile))
			{$s_p_cate.="<a href='".$mdetailsfile."'><translate>".$p_midcate_rows['midcateName']."</translate></a>";}
			else
			{$s_p_cate.="\n<li  class=\"list-group-item side-pro-list-item\"> <a href='javascript:void(0)' > <translate>".$p_midcate_rows['midcateName']."</translate></a>\n<ul class=\"sub-menu\">\n";}
			//$s_p_cate.="<div class=\"subcate_list\">";//小类菜单样式
			while($p_subcate_rows=mysqli_fetch_assoc($p_subcate_query))		//小类生成
			 {
 				$sdetailsfile="../".$p_cate_rows['cateFolders']."/".$p_midcate_rows['midcateFolders']."/".$p_subcate_rows['subcateFolders']."/".($oldcatepath?$p_subcate_rows['subcateFolders'].".html":$menucatename)	; //22-4-19
				$myproid=$p_subcate_rows['ID'];
		    	$cateurl1= catepro1($myproid);//小类下1个产品
		   	 	$sdetailsfile=$cateurl1!=">1"?$cateurl1:$sdetailsfile; //1个产品跳过列表页
				$s_p_cate.="<li> <a href=\"".$sdetailsfile." ><translate>".$p_subcate_rows['subcateName']."</translate></a></li>\n"; 			 }
				$s_p_cate.="</ul>\n\n"; 
				$mycatefolder="../".$p_cate_rows['cateFolders']."/".$p_midcate_rows['midcateFolders']."/".$p_subcate_rows['subcateFolders']."/";	
		  		 if($ifmenupro)file_exists("_menu_product_side_pro.php")?include "_menu_product_side_pro.php":""; 
				$s_p_cate.="</li>";
			} 
		}
		$s_p_cate.="</ul>";
	  }//if($p_midcate_num==0)//dalei
	}
	$s_p_cate.="\n </ul>";
			
?>
