<!-- #include file="include/config.asp" -->
<!-- #include file="../include/jk_ubb.asp" -->
<!-- #include file="../include/jk_review.asp" -->
<%
dim id,c_id,s_id,p_name,p_serial,p_brand,p_stock,p_down_url,p_down_remark,p_remark_1,p_remark_2,p_smallimg,p_bigimg,p_counter,p_buy_counter,p_hidden,p_isgood,p_tim,p_cod,p_keyes,p_price,p_discount,p_is_emoney,p_emoney,p_price_now
id=trim(request.querystring("id"))
if not isnumeric(id) then id=0
sql="select top 1 * from shop_product where hidden=1 and id="&id
set rs=joekoe_cms.exec(sql,1)
if rs.eof then
  rs.close
  call format_redirect("index.asp")
end if
cid=rs("c_id")
sid=rs("s_id")
p_name=rs("name")
p_serial=rs("serial")
p_brand=rs("brand")
p_stock=rs("stock")
p_down_url=rs("down_url")
p_down_remark=rs("down_remark")
p_remark_1=rs("remark_1")
p_remark_2=rs("remark_2")
p_smallimg=rs("smallimg")
p_bigimg=rs("bigimg")
p_counter=rs("counter")
p_buy_counter=rs("buy_counter")
p_hidden=rs("hidden")
p_isgood=rs("isgood")
p_tim=rs("tim")
p_cod=rs("cod")
p_keyes=rs("keyes")
p_price=rs("price")
p_discount=rs("discount")
p_is_emoney=rs("is_emoney")
p_emoney=rs("emoney")
rs.close
p_price_now=fm_price(p_price*(p_discount/100),0)
if int(p_cod)=1 then p_remark_2=code_jk(p_remark_2)

'tit="浏览产品（"&p_name&"）详细信息"
if cint(cid)>0 then
  if cint(sid)>0 then
    sql="select top 1 jk_class.c_name,jk_sort.s_name from jk_sort inner join jk_class on jk_sort.c_id=jk_class.c_id where jk_sort.c_id="&cid&" and jk_sort.s_id="&sid
  else
    sql="select top 1 c_name from jk_class where c_id="&cid
  end if
  set rs=joekoe_cms.exec(sql,1)
  if not rs.eof then
    cname=rs("c_name")
    if sid>0 then sname=rs("s_name")
    tit=cname&"（"&sname&"）"
  end if
  rs.close
end if
tit=cname
url1="list.asp?c_id="&cid
if sname<>"" then
tit2=sname
url2="list.asp?c_id="&cid&"&s_id="&sid
tit3="浏览:"&p_name
else
tit2="浏览:"&p_name
end if

call web_head(0,0,0,0,0)
call shop_load()
'----------------------------左边 开始----------------------------
call shop_left()
call shop_left_nsort(0)
call shop_top(10,22)
call shop_cast_top(6,22)
'----------------------------左边 结束----------------------------
call web_center(0)
'----------------------------中间 开始----------------------------
dim tmp,dinggou,tmppic
if p_stock<>"暂缺" then
 dinggou="<a href='bag.asp?id="&id&"' ><img src='"&joekoe_cms.web_dir_skin&"main/button_bag.gif' border=0></a>"
else
 dinggou="<img src='"&joekoe_cms.web_dir_skin&"main/button_bag.gif' border=0>"
end if
tmppic=pic_fk(p_bigimg,2,pic_url(p_bigimg,0))
tmp=CMS_Skin.GetDB("shop_view")
tmp=Replace(tmp,"{$web_skin}",joekoe_cms.web_dir_skin)
tmp=Replace(tmp,"{$pic}",tmppic)
tmp=Replace(tmp,"{$name}",p_name)
tmp=Replace(tmp,"{$brand}",p_brand)
tmp=Replace(tmp,"{$dinggou}",dinggou)
tmp=Replace(tmp,"{$stock}",p_stock)
tmp=Replace(tmp,"{$id}",id)
tmp=Replace(tmp,"{$buy_counter}",p_buy_counter)
tmp=Replace(tmp,"{$counter}",p_counter)
tmp=Replace(tmp,"{$val_name}",web_dim(44))
tmp=Replace(tmp,"{$price_now}",p_price_now)
tmp=Replace(tmp,"{$val_unit}",web_dim(45))
tmp=Replace(tmp,"{$web_unit}",joekoe_cms.web_unit)
tmp=Replace(tmp,"{$price}",p_price)
tmp=Replace(tmp,"{$discount}",fm_discount(p_discount))
tmp=Replace(tmp,"{$shop_emoney_pay}",shop_emoney_pay(p_is_emoney,p_emoney,id,1))
tmp=Replace(tmp,"{$serial}",p_serial)
tmp=Replace(tmp,"{$ukong}",CMS_Skin.skukong)
tmp=Replace(tmp,"{$remark_1}",joekoe_cms.code_html(p_remark_1,2,0))
tmp=Replace(tmp,"{$remark_2}",p_remark_2)
call shop_center_table("产品浏览",tmp,1,3)
call shop_center_table("相关产品",shop_view_keyes(p_keyes),1,1)
call shop_center_table("相关评论","<tr><td align=center>"&review_type(n_sort,id,joekoe_cms.web_path&"shop/view.asp?id="&id,1,"")&"</td></tr>",1,1)
call joekoe_cms.exec("update shop_product set counter=counter+1 where id="&id,0)
'----------------------------中间 结束----------------------------
call shop_end()
call web_end(0,0)

Function shop_view_keyes(kvar)
  dim sqladd,li,price,price_now,discount,name
  sqladd=sql_key(kvar,"keyes",1,"or")
  li=0
  if sqladd<>"" then
    sql="select id,name,smallimg,brand,price,discount,is_emoney,emoney from shop_product where hidden=1 and "&sqladd&" and id<>"&id&" order by id desc"
    set rs=joekoe_cms.exec(sql,1)
    do while not rs.eof
      if (li mod 2)=0 then shop_view_keyes=shop_view_keyes&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)
      shop_view_keyes=shop_view_keyes&vbcrlf&"<td width='50%'>" &shop_list_type(rs("id"),name,rs("smallimg"),rs("brand"),price,price_now,discount,rs("is_emoney"),rs("emoney"))&"</td>"
      if (li mod 2)>0 then shop_view_keyes=shop_view_keyes&"</tr>"
      rs.movenext
      li=li+1
    loop
    rs.close
    if (li mod 2)>0 then
      shop_view_keyes=shop_view_keyes&"<td width='50%'></td></tr>"
    end if
  else
    shop_view_keyes="<tr><td align=center><font class=gray>没有相关产品</font></td></tr>"
  end if
end Function
%>