<%
'**************************************
'* 最后更新 2012-10-23 by 56770.kingdge
'* 历史更新 2008-6-19 by 56770.WangLei
'* Copyright www.56770.com
'**************************************
Dim addtime,listprice,listtime,listtype,page,sle_type,brand,sel_type,retime
Showpath = "<a href='"& eshop_url & LangPath &"'>"& Lebi_word(0) &"</a> → "& Lebi_pro_unite(0)
page = checknum(request("page"),1)
listprice=safereplace(request("listprice"))
listtime=safereplace(request("listtime"))
listtype=safereplace(request("listtype"))
'..................................
'读取 捆绑促销买区 商品列表
'动态页调用部分
'..................................
Public Function UniteProductList(showheadpage,showfootpage)  'WangLei  2008-2-14
		Dim DataCount,DataList,Filename,i,showpic_width,showpic_height,div_width,div_height,child_arr,sArr,j, LoadListStr,child_url,RLoadStyle(5),strFile,tmpstr,tmpstr2,loopstr,stock,List_num,pic_url,PList_url
        showheadpage = checknum(showheadpage,0) : showfootpage = checknum(showfootpage,0)
	    Dim ors
	    Set ors=new Cls_vbsPage
	    Set ors.Conn=conn
	    With ors
		    .PageSize=top19
		    .PageName="Page"
			If IsSqlDataBase = 0 Then
		            .DbType="AC"
			Else
			        .DbType="MSSQL"
			End If
		    .RecType=0
		    .Pkey="id"
    	    .Field="id,product_name"& LangTxt &",sprice,cprice,sj,product_unite_info,views,stj,ytj,pic,pic_size,cpic,kucun,p_filename"
		    .Table="[Lebi_product_unite]"
		    .Condition="zhuangtai=1"
            .OrderBy="ytj DESC,p_order DESC,sj DESC"
	    End With
	    DataCount=ors.RecCount()
	    DataList=ors.ResultSet()
		List_num = 1
		strFile = Eshop_url& Style_Folder &"Lebi.UniteProductList."
		RLoadStyle(0) = splits(LoadStyle(strFile&"9.style"))	'购买按钮
		RLoadStyle(2) = splits(LoadStyle(strFile&"10.style"))	'预订按钮
		RLoadStyle(3) = splits(LoadStyle(strFile&"11.style"))	'零库存
		RLoadStyle(1) = splits(LoadStyle(strFile&"12.style"))	'收藏按钮
		LoadListStr = "<form action="""" method=""post"" name=""LEBI_FORMBUY_0001"" id=""LEBI_FORMBUY_0001"">"
		LoadListStr = LoadListStr & LoadStyle(strFile&"0.style")
		Select Case show_html
			   Case "0" : Filename = "default.asp"
			   Case "1" : Filename = Eshop_url & LangPath & Folder(8) &"list"
		End Select
		If showheadpage = 1 Then
				tmpstr = LoadStyle(strFile&"1.style")
				ReplaceStyle "headpage",ors.ShowPageHead(Filename),tmpstr
				LoadListStr = LoadListStr & tmpstr
		End If
	    If DataCount > 0 Then
				LoadListStr = LoadListStr & LoadStyle(strFile&"3.style")
				RLoadStyle(4) = splits(LoadStyle(strFile&"4.style"))
				RLoadStyle(5) = splits(LoadStyle(strFile&"5.style")) '捆绑子商品
                For i = 0 To Ubound(DataList,2)
				        loopstr = RloadStyle(4)
						stock=DataList(12,i)
						Select Case show_html
                               Case "0"
									Select Case ISAPI_Rewrite
										   Case "0" PList_url = PagePath(8) &"?id="& DataList(0,i)
										   Case "1" PList_url = LangPath &"unite_show-"& DataList(0,i) &".html"
									End Select
				               Case "1" : PList_url = LangPath & Folder(9) & DataList(13,i) &".1."& Sys_Ext
				        End Select
						If Trim(DataList(9,i))<>"" Then
								tmpstr = ""
								ReplaceStyle "pic_url",picpath &"/"& DataList(9,i),loopstr
								ReplaceStyle "lazyload_pic_url",Eshop_url & picpath &"/"& DataList(9,i),loopstr
								If show_mouse = "0" Then
										pic_url = Split(DataList(9,i),"@@")(0)
										If pic_url = "" Then pic_url = Split(DataList(11,i),"@@")(1)
										tmpstr = " onMouseover=""javascript:ddrivetip('<img src="& Eshop_url & PicPath &"/"& pic_url &" width="& pic_dw &">', '#ffffff', '"& pic_dw + 10 &"')"" onMouseout=""hideddrivetip()"""
								Else
										tmpstr = ""
								End If
								ReplaceStyle "onmouse",tmpstr,loopstr
						End If
						ReplaceStyle "div_width",div_width+10,loopstr
						ReplaceStyle "div_height",div_height+10,loopstr
						ReplaceStyle "url",PList_url,loopstr
						ReplaceStyle "target",Config_Lebi_Eshop(9),loopstr
						ReplaceStyle "id",DataList(0,i),loopstr
						ReplaceStyle "name",DataList(1,i),loopstr
						rem	  会员组价格显示 2008-2-28 by 56770.WangLei
						ReplaceStyle "buy_price",Formatnumber2(DataList(3,i)/moneyhl),loopstr
						ReplaceStyle "market_price",Formatnumber2(DataList(2,i)/moneyhl),loopstr
						ReplaceStyle "pinch_price",Formatnumber2((CDbl(DataList(2,i))-CDbl(DataList(3,i)))/moneyhl),loopstr
						ReplaceStyle "stock",DataList(12,i),loopstr
						rem	 购买、预订、零库存 样式 by 56770.WangLei
						If InStr(loopstr,"{@btn_buy}") > 0 Then
								tmpstr = ""
								if stock <= 0 Then
										Select Case CInt(getGradePurview(17))
											   Case "1" : tmpstr=tmpstr & RLoadStyle(2)	'预定
											   Case "0" : tmpstr=tmpstr & RLoadStyle(3)	'零库存
										End Select
								Else
										tmpstr=tmpstr & RLoadStyle(0)	'购买
								end If
								ReplaceStyle "listcode","0001",tmpstr
								ReplaceStyle "type","unite",tmpstr
								ReplaceStyle "isValid",getGradePurview(0),tmpstr
								ReplaceStyle "id",DataList(0,i),tmpstr
								ReplaceStyle "btn_buy",tmpstr,loopstr
						End If
						rem	}->
						rem	 收藏按钮 by 56770.WangLei
						If InStr(loopstr,"{@btn_fav}") > 0 Then
								tmpstr = ""
								tmpstr = RLoadStyle(1)	'收藏按钮
								ReplaceStyle "id",DataList(0,i),tmpstr
								ReplaceStyle "name",Urlencode(DataList(1,i)),tmpstr
								ReplaceStyle "backurl",Urlencode(geturl()),tmpstr
								ReplaceStyle "type","unite",tmpstr
								ReplaceStyle "btn_fav",tmpstr,loopstr
						End If
						rem	}->
						child_arr = Split(DataList(5,i),"||||")
						tmpstr = ""
						for j=0 to ubound(child_arr)  ' 捆绑子商品循环
								tmpstr2 = RLoadStyle(5)
								sArr = Split(child_arr(j),"||")
								If UBound(sArr) > 3 Then
										Select Case show_html
											   Case "0"
													Select Case ISAPI_Rewrite
														   Case "0"
																Select Case Config_Lebi_Eshop(16)
																	   Case "0" : child_url = "showproduct.asp?id="& sArr(0)
																	   Case "1" : child_url = "product/?id="& sArr(0)
																	   Case "2" : child_url = "product/default.asp?id="& sArr(0)
																End Select
														   Case "1" child_url = "product-"& sArr(0) &".html"
													End Select
											   Case "1"
												   Set rs = conn.execute("select p_filename from [Lebi_product] where id = "& sArr(0) &"")
												   If Not rs.eof Then
														child_url= Folder(0) & rs(0) &".1."& Sys_Ext
												   End If
												   rs.close
										End Select
									   Set rs = conn.execute("select product_name"& LangTxt &" from [Lebi_product] where id = "& sArr(0) &"")
									   If Not rs.eof Then
											product_name = rs(0)
									   End If
									   rs.close
										ReplaceStyle "child_url",LangPath & child_url,tmpstr2
										ReplaceStyle "target",Config_Lebi_Eshop(9),tmpstr2
										ReplaceStyle "child_name",product_name,tmpstr2
										ReplaceStyle "child_num",sArr(4),tmpstr2
										ReplaceStyle "child_price",Formatnumber2(sArr(3)/moneyhl),tmpstr2
										ReplaceStyle "loop_num",j + 1,tmpstr2
								End If
								tmpstr = tmpstr & tmpstr2
						Next
						ReplaceStyle "loop_child",tmpstr,loopstr
						ReplaceStyle "loop_num",i + 1,loopstr
						LoadListStr = LoadListStr & loopstr
                        List_num=List_num+1
                Next
				LoadListStr = LoadListStr & LoadStyle(strFile&"6.style")
		Else
				LoadListStr = LoadListStr & splits(LoadStyle(strFile&"2.style"))
        End If
		If showfootpage = 1 Then
				tmpstr = LoadStyle(strFile&"7.style")
				ReplaceStyle "footpage",ors.ShowPageFoot(Filename),tmpstr
				LoadListStr = LoadListStr & tmpstr
		End If
		LoadListStr = LoadListStr & LoadStyle(strFile&"8.style")
		LoadListStr = LoadListStr & "</form>"
		UniteProductList=LoadListStr
End Function
'============= END WangLei 2008-1-14 =================
%>