<!-- #include file="include/con_shop.asp" -->
<!-- #include file="include/jk_pagecute.asp" -->
<!-- #include file="include/jk_page_cute.asp" -->
<!-- #include file="include/con_shop_list.asp" -->
<%
dim sql_var,nummer,nums,rssum,page,viewpage,thepages,taxis
nummer=8
nums=nummer
tit="产品列表"
call cid_sid()
if int(cid)>0 then
  sql_var=" and c_id="&cid
end if
if int(sid)>0 then
  sql_var=sql_var&" and s_id="&sid
end if
if action<>"" then
  taxis=trim(request.querystring("taxis"))
end if

call web_head(0,0,0,0,0)
call shop_load(1,0,0)
'----------------------------左边 开始----------------------------
call shop_left()
call shop_left_nsort(0)
call shop_cast_top(6,10)
call shop_cs_name()
'----------------------------左边 结束----------------------------
call web_center(0)
'----------------------------中间 开始----------------------------
select case action
case "search"
  call shop_list_search()
case "more"
  call shop_list_more()
case else
  call shop_search()
  call shop_good(sql_var)
  call shop_list()
end select
'----------------------------中间 结束----------------------------
call shop_end()
call web_end(0,0)

sub shop_list_search()
  dim pageurl,sql_add,li,price,price_now,discount,name,sqladd,shead
  li=0
  pageurl="?action="&action&"&c_id="&cid&"&s_id="&sid&"&"
  keyword=code_search(request.querystring("keyword"))
  if action="search" and keyword<>"" then
    sea_type=trim(request.querystring("sea_type"))
    sea_term=trim(request.querystring("sea_term"))
    if sea_term<>"only" then sea_term="all"
    if sea_type="price" then 
      if not joekoe_cms.int_true(keyword) then keyword=0
      sqladd=sqladd&" and price="&keyword
      pageurl=pageurl&"sea_type="&sea_type&"&keyword="&server.urlencode(keyword)&"&"
      shead="&nbsp;&nbsp;搜索结果"
    else
      sql_tmp=sql_key(keyword,sea_type,2,sea_term)
      if sql_tmp<>"" then
        sqladd=sqladd&" and "&sql_tmp
        sql_tmp=""
        pageurl=pageurl&"sea_type="&sea_type&"&keyword="&server.urlencode(keyword)&"&"
        shead="&nbsp;&nbsp;搜索结果"
      end if
    end if  
  end if
  response.write vbcrlf&shop_bar_top(tit&shead,1,1) & _
		 vbcrlf&"<table border=0 width='100%'>"  
  sql="select count(id) from shop_product where hidden=1"&sql_var&sqladd
  set rs=joekoe_cms.exec(sql,1)
  rssum=rs(0)
  rs.close
  call format_pagecute()
  sql="select top "&nummer*viewpage&" id,name,smallimg,brand,price,discount,is_emoney,emoney from shop_product where hidden=1"&sql_var&sqladd&" order by "&shop_list_taxis_sql(taxis)
  call joekoe_cms.exec("",-1)
  rs.open sql,conn,1,1
  if int(viewpage)>1 then
    rs.move (viewpage-1)*nummer
  end if
  if int(viewpage*nummer)>int(rssum) then nums=nummer-(viewpage*nummer-rssum)
  for i=1 to nums
    if (li mod 2)=0 then response.write vbcrlf&"<tr valign=top>"
    name=joekoe_cms.code_html(rs("name"),1,0)
    price=fm_price(rs("price"),0)
    discount=rs("discount")
    price_now=fm_price(price*(discount/100),0)
    discount=fm_discount(discount)
    response.write vbcrlf&shop_list_type(rs("id"),name,rs("smallimg"),rs("brand"),price,price_now,discount,rs("is_emoney"),rs("emoney"))
    if (li mod 2)>0 then response.write vbcrlf&"</tr>"
    rs.movenext
    li=li+1
  next
  rs.close
  response.write vbcrlf&"</table>" & _
		 vbcrlf&shop_bar_end("",0)
  call shop_pagecute(rssum,viewpage,thepages,pageurl,taxis)
end sub
%>