Não está pegando a QUANTIDADE do carrinho e não atualiza..
O que está errado ai ??´
## CÓDIGO que ATUALIZA A QUANTIDADE ##
<!--#include file="includes/abrecon.asp"-->
<!--#include file="includes/funcoes.asp"-->
<%
On Error Resume Next
if request.form <> empty then
For Each Item in Request.Form
'verificando quantidade que tenho em estoque
sql = "SELECT id,prod_estoque FROM produtos WHERE id ="& Item &" "
set rs = cn.execute(sql)
'caso meu estoque seja menor que o pedido, avisa o cliente
if request.form( Item ) > rs("prod_estoque") then
estoque = rs("prod_estoque")
%>
<script>
alert('Garantimos apenas'+ estoque +'unidades');
</script>
<%
altera = "update pedidos_item set qtd_prod ="& rs("prod_estoque") &" WHERE id_ped ="& Session("CodPed") &" AND id_prod ="& Item
cn.execute(altera)
response.Redirect "index.asp?menu=4"
else
altera = "update pedidos_item set qtd_prod ="& request.form( Item ) &" WHERE id_ped ="& Session("CodPed") &" AND id_prod ="& Item
cn.execute(altera)
response.Redirect "index.asp?menu=4"
end if
Next
end if
If Err.number <> 0 then
Response.Write "O número do erro é: " & Err.number & "<BR>"
Response.Write "A descrição fornecida é: " & Err.Description & "<BR>"
End If
%>
<!--#include file="includes/fechacon.asp"-->
Pergunta
Luisinho
Galera, me ajudem com esse código...
Não está pegando a QUANTIDADE do carrinho e não atualiza..
O que está errado ai ??´
## CÓDIGO que ATUALIZA A QUANTIDADE ##
<!--#include file="includes/abrecon.asp"--> <!--#include file="includes/funcoes.asp"--> <% On Error Resume Next if request.form <> empty then For Each Item in Request.Form 'verificando quantidade que tenho em estoque sql = "SELECT id,prod_estoque FROM produtos WHERE id ="& Item &" " set rs = cn.execute(sql) 'caso meu estoque seja menor que o pedido, avisa o cliente if request.form( Item ) > rs("prod_estoque") then estoque = rs("prod_estoque") %> <script> alert('Garantimos apenas'+ estoque +'unidades'); </script> <% altera = "update pedidos_item set qtd_prod ="& rs("prod_estoque") &" WHERE id_ped ="& Session("CodPed") &" AND id_prod ="& Item cn.execute(altera) response.Redirect "index.asp?menu=4" else altera = "update pedidos_item set qtd_prod ="& request.form( Item ) &" WHERE id_ped ="& Session("CodPed") &" AND id_prod ="& Item cn.execute(altera) response.Redirect "index.asp?menu=4" end if Next end if If Err.number <> 0 then Response.Write "O número do erro é: " & Err.number & "<BR>" Response.Write "A descrição fornecida é: " & Err.Description & "<BR>" End If %> <!--#include file="includes/fechacon.asp"-->## FORMULÁRIO DO CARRINHO ##<form name="form" id="form" method="post" action="check_qtd.asp"> <tr> <td width="19%" height="30" align="center" class="bg-azul-claro"><span class="Texto-05">Foto</span></td> <td width="24%" height="30" align="center" class="bg-azul-claro"><span class="Texto-05">Nome do produto</span></td> <td width="18%" align="center" class="bg-azul-claro"><span class="Texto-05">Valor Unit.</span></td> <td width="9%" height="30" align="center" class="bg-azul-claro"><span class="Texto-05">Quant.</span></td> <td width="23%" height="30" align="center" class="bg-azul-claro"><span class="Texto-05">Total</span></td> <td width="7%" align="center" class="bg-azul-claro"><span class="Texto-05">Del.</span></td> </tr> <% subtotal=0 do while not rs.eof if rs("prod_valor_promo") <> "" Then prod_valor = rs("prod_valor_promo") else prod_valor = rs("prod_valor") end if %> <tr> <td class="tabela-3"><img src="thumb.asp?path=fotos/<%=rs("prod_foto")%>&WIDTH=100&HEIGHT=102" width="100" height="102" border="0" /></td> <td class="tabela-3"><span class="Texto-03"><%=rs("prod_nome")%></span></td> <td align="center" class="tabela-3"><span class="Texto-08"><%=formatcurrency(prod_valor)%></span></td> <td align="center" class="tabela-3"><input type="text" name="<%=rs("id_prod")%>" value="<%=rs("qtd_prod")%>" size="2" class="Texto-06" /></td> <td align="center" bgcolor="#F4F4F4" class="tabela-3"><span class="Texto-08"><%= FormatCurrency(rs("qtd_prod") * prod_valor)%></span></td> <td align="center" class="tabela-3"><img src="images/ico_del.gif" width="16" height="15" border="0" /></td> </tr> <% subtotal = subtotal + formatcurrency(prod_valor * rs("qtd_prod")) rs.movenext Loop %> <tr> <td height="30"> </td> <td height="30" align="right"> </td> <td height="30" colspan="2" align="right"> </td> <td height="30" align="center" class="tabela-3 bg-cinza-claro"> </td> <td height="30"></td> </tr> <tr> <td height="30"> </td> <td height="30" align="right"><input type="submit" class="Texto-05" value="Recalcular" /></td> <td height="30" colspan="2" align="right"><span class="Texto-08">Sub Total R$ </span></td> <td height="30" align="center" class="tabela-3 bg-cinza-claro"><span class="Texto-08"><%=formatcurrency (subtotal)%></span></td> <td height="30"></td> </tr> </form>Veja no site como está:
http://www.wdlc.com.br/eloja/index.asp
Está atualizando tudo errado
Link para o comentário
Compartilhar em outros sites
2 respostass a esta questão
Posts Recomendados
Participe da discussão
Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.