<% dim oConn, rs2, cat_id, sql, city_id, busca, existe_item, count existe_item = false city_id = request.QueryString("sltCidade") cat_id = request.QueryString("sltCategoria") busca = request.QueryString("txtBusca") if (cat_id <> "" and not isnumeric(cat_id)) or (city_id <> "" and not isnumeric(city_id)) then response.Redirect("produtos.asp") end if set oConn = new clsConnection set rs2 = server.CreateObject("ADODB.Recordset") %>
Produtos
<% sql = "select evt_id, evt_name, evt_description, evt_url" sql = sql & " from tb_produtos" sql = sql & " where evt_activestatus = true and evt_destaque = false" if cat_id <> "" then sql = sql & " and cat_id = " & cat_id end if if city_id <> "" then sql = sql & " and city_id = '" & city_id & "' " end if if busca <> "" then sql = sql & " and (evt_name like '%" & busca & "%' or evt_description like '%" & busca & "%' )" end if sql = sql & " order by evt_name asc" oConn.rs.open sql, oConn.Conn, 3, 2 if oConn.rs.recordCount > 0 then existe_item = true while not oConn.rs.eof rs2.open "select top 1 eim_id, eim_image from tb_produtos_image where eim_activestatus = true and evt_id = " & oConn.rs("evt_id"), oConn.Conn, 3, 2 %>
<% if rs2.recordCount = 1 then %> "> &width=400&height=300" alt="Image" width="100%" border="0" />"> <% end if %>
<%= oConn.rs("evt_name") %>
"> <%= oFun.Truncate(oConn.rs("evt_description"),100) %>
"> Saiba + detalhes!
<% rs2.close oConn.rs.movenext wend end if set rs2 = nothing oConn.rs.close set oConn = nothing if not existe_item then %>
Sem ítem cadastrado no momento!
<% end if %>