<?php

//1、主菜单 product 下拉菜单 56 public  {ls_s_cate}。支持产品在菜单类别下列出，如存在文件 _menu_product_down_pro.php
//2、页脚菜单 {ls_d_cate} $d_pro_cate

if($ProMenuStyle=="Horizontal") {  include("_menu_product_down_catehori.php");  } // 大类横在主菜单,中类下拉
else{
 $s_pro_cate="<ul class=\"protit dropdown-menu pingpu\">";
	$x = $pro_num;
	$y = 0;
	while($pro_cate_rows=mysqli_fetch_assoc($pro_cate_query))
	{
		$oldcatename= $oldpropath? "index.html" :$pro_cate_rows['cateFolders'].".html";//zhengdu
		 
	  $y++;
	  $pro_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=".$pro_cate_rows['ID']." order by Num asc";
	  $pro_midcate_query=$opendb->query($pro_midcate_sql);
	  $pro_midcate_num=mysqli_num_rows($pro_midcate_query);
	  $detailsfile=$ifcatelink?"../".$pro_cate_rows['cateFolders']."/".$oldcatename:"javascript:void(01)";//.html".$pro_cate_rows['cateFolders']."
	  $detailsfile2="../".$templates_var."/catedetail.html";
	  if($pro_midcate_num==0)//大类无中类
	  {
		//$s_pro_cate.="&nbsp;<img src='../Templates/images/cate.gif' border='0'> \n";
		//$s_pro_cate.="\n<dt>".$pro_cate_rows['cateName']."</dt>";
		  $myproid=$pro_cate_rows['ID'];
		  $cateurl1= catepro1($myproid);//大类下1个产品
		  $detailsfile=$cateurl1!=">1"?$cateurl1:$detailsfile; //1个产品跳过列表页
		  $s_pro_cate.="<li class=\"pingputwo\"><a href='".$detailsfile."'><i class=\"icon-radio-checked\"></i><translate>".$pro_cate_rows['cateName']."</translate></a>";
		  $mycatefolder="../".$pro_cate_rows['cateFolders']."/";
		  //产品列表					  
		 if($ifmenupro)file_exists("_menu_product_down_pro.php")?include "_menu_product_down_pro.php":""; 
		  $s_pro_cate.="</li>";
		// $s_pro_cate.="\n <div class=\"cate_list\">\n"; //大类菜单样式，div css:cate_list
	  } 
	  else//大类中类
	  {
		//$s_pro_cate.="&nbsp;<img src='../Templates/".$templates_var."/images/cate.gif' border='0'> \n";  //大类引导图
		if(file_exists($detailsfile2)){
			//../{ls_addprolink} <a href='".$detailsfile."' ><translate> </translate></a>
			$s_pro_cate.="\n<li class=\"menu-item\"><a>".$pro_cate_rows['cateName']."</a><ul class=\"list-unstyled\" id=\"content".$pro_cate_rows['ID']."\" >";
		}else{
			$s_pro_cate.="\n<li class=\"menu-item\"><a href='javascript:void(01)' onclick=\"turnit(".$pro_cate_rows['ID'].",".$pro_cate_rows['ID'].");this.href=this.href+'?menuId='+".$pro_cate_rows['ID']."+'&cate='+".$pro_cate_rows['ID'].";\" ><translate>".$pro_cate_rows['cateName']."</translate></a><ul class=\"list-unstyled\" id=\"content".$pro_cate_rows['ID']."\" >";
		}
		//？ 不应该有$s_pro_cate.="\n <div class=\"cate_list\">\n";
		while($pro_midcate_rows=mysqli_fetch_assoc($pro_midcate_query))
		{
			$oldmidcatename= $oldpropath? "index.html" :$pro_midcate_rows['midcateFolders'].".html";//zhengdu
			$pro_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=".$pro_midcate_rows['ID']." order by Num asc";
			$pro_subcate_query=$opendb->query($pro_subcate_sql);
			$pro_subcate_num=mysqli_num_rows($pro_subcate_query);
			$mdetailsfile="../".$pro_cate_rows['cateFolders']."/".$pro_midcate_rows['midcateFolders']."/".$oldmidcatename;			
			$myproid=$pro_midcate_rows['ID'];
		    $cateurl1= catepro1($myproid);//中类下1个产品
		    $mdetailsfile=$cateurl1!=">1"?$cateurl1:$mdetailsfile; //1个产品跳过列表页
			//$s_pro_cate.="<div class=\"midcate_list\">"; //中类菜单样式
			if($pro_subcate_num==0)//没小类
			{
				$s_pro_cate.="\n<li class=\"menu-item\"><a href='".$mdetailsfile."' onclick=\"turnit(".$pro_cate_rows['ID'].",".$pro_cate_rows['ID'].");this.href=this.href+'?menuId='+".$pro_cate_rows['ID']."+'&cate='+".$pro_cate_rows['ID'].";\"><translate>".$pro_midcate_rows['midcateName']."</translate></a>"; //".$pro_midcate_rows['midcateFolders'].".html
				$mycatefolder="../".$pro_cate_rows['cateFolders']."/".$pro_midcate_rows['midcateFolders']."/";	
				//产品列表				
		  		  if($ifmenupro)file_exists("_menu_product_down_pro.php")?include "_menu_product_down_pro.php":""; 
		  		$s_pro_cate.="</li>";
			}
			else//有小类
			{
			//$s_pro_cate.="&nbsp;<img src='../Templates/".$templates_var."/images/midcate.gif' border='0'> \n"; //中类引导图
			//$mdetailsfile=$mdetailsfile.".$pro_midcate_rows['midcateName'].".html
			if(file_exists($detailsfile))
			{$s_pro_cate.="<li class=\"menu-item\"><a href='".$mdetailsfile."'><translate>".$pro_midcate_rows['midcateName']."<translate></a><ul>";}
			else
			{$s_pro_cate.="\n<li class=\"menu-item\"> <a href='javascript:void(0)' ><span class=\"glyphicon\"></span> <translate>".$pro_midcate_rows['midcateName']."</translate></a>\n<ul class=\"sub-menu2\">\n";} //glyphicon-forward
			//$s_pro_cate.="<div class=\"subcate_list\">";//小类菜单样式
			while($pro_subcate_rows=mysqli_fetch_assoc($pro_subcate_query))		//小类生成
			 {
				$oldsubcatename= $oldpropath? "index.html" :$pro_subcate_rows['subcateFolders'].".html";//zhengdu
				$sdetailsfile.=$pro_subcate_rows['subcateFolders']."/".$oldsubcatename;
				$myproid=$pro_subcate_rows['ID'];
		    	$cateurl1= catepro1($myproid);//小类下1个产品
		   	 	$sdetailsfile=$cateurl1!=">1"?$cateurl1:$sdetailsfile; //1个产品跳过列表页
				$s_pro_cate.="<li class=\"menu-item\"> <a href=\"".$sdetailsfile."\" ><translate>".$pro_subcate_rows['subcateName']."</translate></a>\n"; //".$pro_subcate_rows['subcateFolders'].".html
				$mycatefolder="../".$pro_cate_rows['cateFolders']."/".$pro_midcate_rows['midcateFolders']."/".$pro_subcate_rows['subcateFolders']."/";	
				//file_exists("_menu_product_down_pro.php")?include "_menu_product_down_pro.php":""; //产品列表
				$s_pro_cate.="</li>";
			 }
			$s_pro_cate.="</ul>\n</li>\n"; 
			} 
		}
		$s_pro_cate.="</ul>";
	  }//if($pro_midcate_num==0)//dalei
	}
	$s_pro_cate.="\n </ul>";
}//end $ProMenuStyle

	
//2、页脚产品菜单 {ls_d_cate} $d_pro_cate 2021-4-6 产品列出 _menu_product_bott_pro.php

 $d_pro_cate="<ul class=\"protit_food\">";
	$x = $pro_num;
	$y = 0;
	$oldcatename= $oldpropath? "index.html" :"";
	mysqli_data_seek($pro_cate_query, 0); //指针复位
	while($pro_cate_rows=mysqli_fetch_assoc($pro_cate_query))
	{
	  $y++;
	  $pro_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=".$pro_cate_rows['ID']." order by Num asc";
	  $pro_midcate_query=$opendb->query($pro_midcate_sql);
	  $pro_midcate_num=mysqli_num_rows($pro_midcate_query);
	  $detailsfile=$ifcatelink?"../".$pro_cate_rows['cateFolders']."/".$oldcatename:"javascript:void(01)";//.html".$pro_cate_rows['cateFolders']."
	  $detailsfile2="../".$templates_var."/catedetail.html";
	  if($pro_midcate_num==0)//大类无中类
	  {
		//$d_pro_cate.="&nbsp;<img src='../Templates/images/cate.gif' border='0'> \n";
		//$d_pro_cate.="\n<dt>".$pro_cate_rows['cateName']."</dt>";
		  $myproid=$pro_cate_rows['ID'];
		  $cateurl1= catepro1($myproid);//大类下1个产品
		  $detailsfile=$cateurl1!=">1"?$cateurl1:$detailsfile; //1个产品跳过列表页
		  $d_pro_cate.="<li class=\"pingputwo_food\"><div class=\"footer_tit\"><span> <a href='".$detailsfile."'><translate>".$pro_cate_rows['cateName']."</translate></a></span></div>";
		  $mycatefolder="../".$pro_cate_rows['cateFolders']."/";
		  //产品列表			
		 // echo  "bott大类无中类-".$mycatefolder;
		   if($ifmenupro)file_exists("_menu_product_bott_pro.php")?include "_menu_product_bott_pro.php":""; 
		  $d_pro_cate.="</li>";
		// $d_pro_cate.="\n <div class=\"cate_list\">\n"; //大类菜单样式，div css:cate_list
	  } 
	  else//大类中类
	  {
		//$d_pro_cate.="&nbsp;<img src='../Templates/".$templates_var."/images/cate.gif' border='0'> \n";  //大类引导图
		if(file_exists($detailsfile2)){
			//../{ls_addprolink}
			$d_pro_cate.="\n<li class=\"menu-item_food\"><a href='".$detailsfile."' ><translate>".$pro_cate_rows['cateName']."</translate></a><ul class=\"list-unstyled_food\" id=\"content".$pro_cate_rows['ID']."\" >";
		}else{
			$d_pro_cate.="\n<li class=\"menu-item_food\"><a href='javascript:void(01)' onclick=\"turnit(".$pro_cate_rows['ID'].",".$pro_cate_rows['ID'].");this.href=this.href+'?menuId='+".$pro_cate_rows['ID']."+'&cate='+".$pro_cate_rows['ID'].";\" ><translate>".$pro_cate_rows['cateName']."</translate></a><ul class=\"list-unstyled_food\" id=\"content".$pro_cate_rows['ID']."\" >";
		}
		//？ 不应该有$d_pro_cate.="\n <div class=\"cate_list\">\n";
		while($pro_midcate_rows=mysqli_fetch_assoc($pro_midcate_query))
		{
			$pro_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=".$pro_midcate_rows['ID']." order by Num asc";
			$pro_subcate_query=$opendb->query($pro_subcate_sql);
			$pro_subcate_num=mysqli_num_rows($pro_subcate_query);
			$mdetailsfile="../".$pro_cate_rows['cateFolders']."/".$pro_midcate_rows['midcateFolders']."/".$oldcatename;			
			$myproid=$pro_midcate_rows['ID'];
		    $cateurl1= catepro1($myproid);//中类下1个产品
		    $mdetailsfile=$cateurl1!=">1"?$cateurl1:$mdetailsfile; //1个产品跳过列表页
			//$d_pro_cate.="<div class=\"midcate_list\">"; //中类菜单样式
			if($pro_subcate_num==0)//没小类
			{
				$d_pro_cate.="\n<li class=\"menu-item_food\"><a href='".mdetailsfile."' onclick=\"turnit(".$pro_cate_rows['ID'].",".$pro_cate_rows['ID'].");this.href=this.href+'?menuId='+".$pro_cate_rows['ID']."+'&cate='+".$pro_cate_rows['ID'].";\"><translate>".$pro_midcate_rows['midcateName']."</translate></a>"; //".$pro_midcate_rows['midcateFolders'].".html
				$mycatefolder="../".$pro_cate_rows['cateFolders']."/".$pro_midcate_rows['midcateFolders']."/";	
				//产品列表		
				//echo  "bott中类没小类-".$mycatefolder;
		  		 if($ifmenupro)file_exists("_menu_product_bott_pro.php")?include "_menu_product_bott_pro.php":""; 
		  		$d_pro_cate.="</li>";
			}
			else//有小类
			{
			//$d_pro_cate.="&nbsp;<img src='../Templates/".$templates_var."/images/midcate.gif' border='0'> \n"; //中类引导图
			//$mdetailsfile=$mdetailsfile.".$pro_midcate_rows['midcateName'].".html
			if(file_exists($detailsfile))
			{$d_pro_cate.="<li class=\"menu-item_food\"><a href='".$mdetailsfile."'><translate>".$pro_midcate_rows['midcateName']."<translate></a><ul>";}
			else
			{$d_pro_cate.="\n<li class=\"menu-item_food\"> <a href='javascript:void(0)' ><span class=\"glyphicon\"></span> <translate>".$pro_midcate_rows['midcateName']."</translate></a>\n<ul class=\"sub-menu2\">\n";} //glyphicon-forward
			//$d_pro_cate.="<div class=\"subcate_list\">";//小类菜单样式
			while($pro_subcate_rows=mysqli_fetch_assoc($pro_subcate_query))		//小类生成
			 {
				$sdetailsfile.=$pro_subcate_rows['subcateFolders']."/".$oldcatename;
				$myproid=$pro_subcate_rows['ID'];
		    	$cateurl1= catepro1($myproid);//小类下1个产品
		   	 	$sdetailsfile=$cateurl1!=">1"?$cateurl1:$sdetailsfile; //1个产品跳过列表页
				$d_pro_cate.="<li class=\"menu-item_food\"> <a href=\"".$sdetailsfile."\" ><translate>".$pro_subcate_rows['subcateName']."</translate></a>\n"; //".$pro_subcate_rows['subcateFolders'].".html
				$mycatefolder="../".$pro_cate_rows['cateFolders']."/".$pro_midcate_rows['midcateFolders']."/".$pro_subcate_rows['subcateFolders']."/";	
				//file_exists("_menu_product_bott_pro.php")?include "_menu_product_bott_pro.php":""; //产品列表
				$d_pro_cate.="</li>";
			 }
			$d_pro_cate.="</ul>\n</li>\n"; 
			} 
		}
		$d_pro_cate.="</ul>";
	  }//if($pro_midcate_num==0)//dalei
	}

	$d_pro_cate.="\n </ul>";	

?>

