Ver Mensaje Individual
  #1 (permalink)  
Antiguo 21/07/2003, 09:42
Makesth
 
Fecha de Ingreso: junio-2003
Mensajes: 7
Antigüedad: 21 años, 10 meses
Puntos: 0
Enviar datos con CDONTS

Tengo el siguiente carrito de la compra y quisiera recibir los datos por email con CDONTS, mi problema es que no se donde poner el codigo, y la verdad creo que lo he intentado todo pero en lugar de avanzar voy para atras... estoy perdida.

Gracias por la ayuda


<%@LANGUAGE="VBSCRIPT"%>
<%Option Explicit%>
<%Response.Buffer=True%>
<%

Sub MostrarCatalogo

Dim oRs, oRs2, SQL ' Uso 2 recordset
Dim idTipog ' IdMarca en Productos

set oRs=Server.CreateObject("ADODB.Recordset")
set oRs2=Server.CreateObject("ADODB.Recordset")

SQL="SELECT * FROM Galeria;"

oRs.Open SQL, oConn

%>
<script LANGUAGE="JavaScript">
<!--
function CargarFoto(img, ancho, alto){
derecha=(screen.width-ancho)/2;
arriba=(screen.height-alto)/2;
string="toolbar=0,scrollbars=0,location=0,statusba r=0,menubar=0,resizable=1,width="+ancho+",height=" +alto+",left="+derecha+",top="+arriba+"";
fin=window.open(img,"",string);
}
// -->
</script>
<body background="images/Background1.gif">

<TABLE BORDER=1 CELLSPACING="1" CELLPADDING="1" height="118" width="494">
<TR>
<TD height="19" width="45"><B>Marca</B></TD>
<TD height="19" width="311"><B>Producto</B></TD>
<TD height="19" width="52"><B>Precio</B></TD>
<TD height="19" width="63"></TD>

<%
do until oRs.EOF
idtipog=oRs.Fields("IdTipoG")

SQL="SELECT * FROM GTipo WHERE IdTipoG="&idtipog&";"
oRs2.Open SQL, oConn

%>

<TR>
<TD height="89" width="45"><%=oRs2.Fields("IdTipoG")%></A></TD>
<td width="34%" height="1" style="border-style: none; border-width: medium; " align="center" bordercolorlight="#00FFFF" bordercolordark="#008000" bordercolor="#00FF00">
<p align="center">

<font size="4" face="Harrington">


<a href="javascript:CargarFoto('showimg.asp?ID=<%=oRS ("ID")%>','570','420')">

<img src="Fotos/<%=oRS("Images")%>" height=210 width=180 border=0 alt="Pulsa para ampliar" align="left">
</a></td>
<TD height="89" width="52"><%=oRs.Fields("Precio")%><p align="center">
&nbsp;</TD>
<TD height="89" width="63"><A HREF="Galeria.asp?ac=meter&prod=<%=oRs.Fields("ID" )%>">Comprar</A></TD>
</TR>
<%
oRs2.Close
oRs.MoveNext
loop

%>
</TABLE>
<%
oRs.Close
set oRs=nothing
set oRs2=nothing

%>
<center><A HREF=Galeria.asp?ac=ver>Ver Carrito</A></center>

<%
End Sub


Sub MostrarCarrito

Dim oRs, oRs2, SQL

Dim clave

Dim gastos ' Gastos de envio
Dim total, subtotal

gastos=4 ' Para todo el mundo! :)
total=0
subtotal=0


set oRs=Server.CreateObject("ADODB.Recordset")

%>
<TABLE BORDER="1" CELLPADDING="1" CELLSPACING="1">
<TR>
<TD>Artículo</TD>
<TD>Cantidad</TD>
<TD>Precio/unidad</TD>
<TD>Quitar del carrito</TD>
<TD>Total</TD>
</TR>
<%
For Each clave in carrito
subtotal=0 ' Total de cada artículo en el carrito

SQL="SELECT * FROM Galeria WHERE ID="&clave&";"
set oRs=oConn.Execute(SQL)

%>
<TR>

<TD>
<img src="Fotos/<%=oRS("Images")%>" height=59 width=58 border=0 alt="Pulsa para ampliar" align="left">
</TD>
<TD><%=carrito(clave)%>&nbsp;</TD>
<TD><%=oRs.Fields("Precio")%>&nbsp;</TD>
<TD><A HREF="Galeria.asp?ac=sacar&prod=<%=clave%>&cant=1" >Quitar Uno</A>
<A HREF="Galeria.asp?ac=sacar&prod=<%=clave%>&cant=<% =carrito(clave)%>">Quitar Todos</A>
</TD>
<%

subtotal=CSng(FormatNumber(carrito(clave))*oRs.Fie lds("Precio"))
total=total+subtotal
%>
<TD><%= subtotal %>&nbsp;</TD>
</TR>
<%
Next

if carrito.Count > 0 then
oRs.Close
set oRs=nothing
end if


%>
<TR>
<TD COLSPAN=4>Gastos de envío</TD>
<TD>
<%
if total=0 then
Response.Write("0")
else
Response.Write(gastos)
end if
%> &nbsp;</TD>
<TR>
<TD COLSPAN=4><B>Total:</B></TD>
<TD>
<%if total=0 then
Response.Write("0")
else
Response.Write(total+gastos)
end if
%> &nbsp;</TD>
</TABLE>
<%
if accion<>"fin" then
%>
<center>
<A HREF=Galeria.asp>Seguir mirando</A> / <A HREF=Galeria.asp?ac=fin>Pasar por caja</A>
</center>
<%
end if
End Sub


Sub MeterArticulo (id)

if carrito.Exists(id) then
carrito(id)=carrito(id)+1
else

carrito.Add id, 1
end if
Response.Write("Se ha añadido el artículo al carrito<br>")
End Sub

Sub SacarArticulo (id, cantidad)

if not carrito.Exists(id) then
Response.Write("¡No tienes eso en tu carrito!")
else
if cantidad>1 then

carrito.Remove(id)
else

carrito(id)=carrito(id)-1
if carrito(id)<1 then
carrito.Remove(id)
end if
end if
end if

End Sub

Sub PasarPorCaja

%>
<H2>¡Gracias por comprar!</H2>
<%
MostrarCarrito
%>
En breve te llegarán a tu casa los productos.
<br>
(En un caso real aquí pediríamos los datos, etc.)
<p>

<td width="3%" align="left" valign="top" style="border-style:none; border-width:medium; " height="282">
<p></p>
</td>
<td width="115%" align="left" valign="top" style="border-style:none; border-width:medium; " height="282">





<table border="1" cellpadding="0" cellspacing="0" style="border-width:0; border-collapse: collapse; " bordercolor="#111111" width="171%" id="AutoNumber7" height="159">
<tr>
<%

set Session("carrito")=nothing
End Sub


Dim carrito
Dim accion
Dim producto
Dim cant
Dim oConn


set oConn=Server.CreateObject("ADODB.Connection")
oConn.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("Artellares.mdb")


if isobject(Session("carrito")) then
set carrito=Session("carrito")
else
set carrito=Server.CreateObject("Scripting.Dictionary" )
end if

accion=CStr(Request.QueryString("ac"))
producto=CInt(Request.QueryString("prod"))
cant=CInt(Request.QueryString("cant"))

Select Case accion

Case "ver"
MostrarCarrito

Case "meter"
MeterArticulo producto
MostrarCarrito

Case "sacar"
call SacarArticulo (producto, cant)
MostrarCarrito

Case "fin"
PasarPorCaja

Case else
MostrarCatalogo

End Select

set Session("carrito")=carrito
oConn.Close
set oConn=nothing

%>