Ver Mensaje Individual
  #7 (permalink)  
Antiguo 22/07/2004, 16:32
el_principiante
 
Fecha de Ingreso: julio-2004
Mensajes: 7
Antigüedad: 20 años, 10 meses
Puntos: 0
Ok.. aqui estoy de vuelta yo y con el mismo problema, vean, vi los dos ejemplos que amablemente ustedes colocaron aqui, y ya los tendre en cuenta para futuras ocasiones, el problema es que yo quiero que la imagen desplegada venga de un campo de una tabla de la base de datos dependiendo del producto que sea...

traigo el codigo para ver si pueden ayudarme...

lo pongo en dos partes porque esta bastante grande... como mencionaba arriba, apenas estoy comenzando con ASP, fue mi socio quien hizo practicamente todo aqui y yo no termino de aprender aun muchas cosas de ASP.

la URL de cada imagen se encuentra en la tabla options de la base de datos, el campo se llama optfImage y necesito que cuando el cliente selecciones una opcion, la imagen guardada en ese campo para ese registro sea desplegada...

Si pudieran ayudarme se los agradeceria infinitamente...

Código HTML:
<%
Dim sSQL,rs,alldata,useEuro,cnn,rowcounter,iNumOfPages,CurPage,Count,weburl,longdesc,aOption()
if Trim(explicitid)<>"" then prodid=Trim(explicitid) else prodid=Trim(request.querystring("prod"))
WSP = ""
if Session("clientUser")<>"" then
	if (Session("clientActions") AND 8) = 8 then WSP = "pWholesalePrice AS "
end if
netnav = true
if instr(Request.ServerVariables("HTTP_USER_AGENT"), "compatible") > 0 OR instr(Request.ServerVariables("HTTP_USER_AGENT"), "Gecko") > 0 then netnav = false
function atb(size)
	if netnav then
		atb = CInt(size / 2 + 1)
	else
		atb = size
	end if
end function
Redim aOption(2,maxprodopts)
Count=0
Set rs = Server.CreateObject("ADODB.RecordSet")
Set rs2 = Server.CreateObject("ADODB.RecordSet")
Set cnn=Server.CreateObject("ADODB.Connection")
cnn.open sDSN
sSQL = "SELECT countryLCID,countryCurrency,countryTax,adminStockManage,currRate1,currSymbol1,currRate2,currSymbol2,currRate3,currSymbol3,currConvUser,currConvPw,currLastUpdate FROM admin INNER JOIN countries ON admin.adminCountry=countries.countryID WHERE adminID=1"
rs.Open sSQL,cnn,0,1
countryCurrency = rs("countryCurrency")
useEuro = (countryCurrency="EUR")
useStockManagement = rs("adminStockManage")<>0
if orlocale<>"" then
	saveLCID = orlocale
elseif rs("countryLCID")<>0 then
	saveLCID = rs("countryLCID")
else
	saveLCID=1033
end if
countryTax=cDbl(rs("countryTax"))
currRate1=cDbl(rs("currRate1"))
currSymbol1=trim(rs("currSymbol1"))
currRate2=cDbl(rs("currRate2"))
currSymbol2=trim(rs("currSymbol2"))
currRate3=cDbl(rs("currRate3"))
currSymbol3=trim(rs("currSymbol3"))
currConvUser=rs("currConvUser")
currConvPw=rs("currConvPw")
currLastUpdate=rs("currLastUpdate")
rs.Close
Call checkCurrencyRates(currConvUser,currConvPw,currLastUpdate,currRate1,currSymbol1,currRate2,currSymbol2,currRate3,currSymbol3)
Session.LCID = saveLCID
Session("frompage")=Request.ServerVariables("URL")&IIfVr(Trim(Request.ServerVariables("QUERY_STRING"))<>"","?","")&Request.ServerVariables("QUERY_STRING")
sSQL = "SELECT pId,pName,pImage,"&WSP&"pPrice,pSection,pListPrice,pSell,pInStock,pExemptions,pLargeImage,pDescription,pLongDescription FROM products WHERE pId='"&Replace(prodid,"'","''")&"'"
rs.Open sSQL,cnn,0,1,&H0001
if rs.EOF then
	response.write "Sorry, specified product does not exist"
else
tslist = ""
if IsNull(rs("pSection")) then catid = 0 else catid = rs("pSection")
thetopts = catid
topsectionids = catid
isrootsection=false
for index=0 to 10
	if thetopts=0 then
		if catid="0" then
			tslist = xxHome & " " & tslist
		else
			tslist = "<a href=""categories.asp"">"&xxHome&"</a> " & tslist
		end if
		exit for
	elseif index=10 then
		tslist = "<b>Loop</b>" & tslist
	else
		sSQL = "SELECT sectionID,topSection,sectionName,rootSection FROM sections WHERE sectionID=" & thetopts
		rs2.Open sSQL,cnn,0,1
		if NOT rs2.EOF then
			if rs2("rootSection")=1 then
				tslist = " &raquo; <a href=""products.asp?cat="& rs2("sectionID") & """>" & rs2("sectionName") & "</a>" & tslist
			else
				tslist = " &raquo; <a href=""categories.asp?cat="& rs2("sectionID") & """>" & rs2("sectionName") & "</a>" & tslist
			end if
			thetopts = rs2("topSection")
			topsectionids = topsectionids & "," & thetopts
		else
			tslist = "Top Section Deleted" & tslist
			rs2.Close
			exit for
		end if
		rs2.Close
	end if
next
saveLCID = Session.LCID
prodoptions=""
productdisplayscript(true)
updatepricescript(true) %>
      <table border="0" cellspacing="<%=maintablespacing%>" cellpadding="<%=maintablepadding%>" width="<%=maintablewidth%>" bgcolor="<%=maintablebg%>" align="center">
        <tr> 
          <td width="100%">
		    <form method="POST" name="tForm<%=Count%>" action="cart.asp" onSubmit="return formvalidator<%=Count%>(this)">
<%	if IsEmpty(showcategories) OR showcategories=true then %><b><font color="#FFFFFF" face="Times New Roman">
</font></b>
            <table width="<%=innertablewidth%>" border="0" cellspacing="<%=innertablespacing%>" cellpadding="<%=innertablepadding%>" bgcolor="<%=innertablebg%>">
              <tr> 
                <td colspan="3" align="<%=headeralign%>"><b><%=tslist%></b><b><font color="#FFFFFF" face="Times New Roman"><br>
                  <img src="images/clearpixel.gif" width="350" height="8"></font></b></td>
                <td align="right"><font face="Times New Roman"><b>
                <font color="#FFFFFF">&nbsp;<% if nobuyorcheckout<>true then %></font><a href="cart.asp"><font color="#FFFFFF"><img src="images/checkout.gif" border="0"></font></a><font color="#FFFFFF"><% end if %></font></b></td>
              </tr>
			</table>
<%	end if
	alldiscounts = ""
	if noshowdiscounts<>true then
		Session.LCID = 1033
		tdt = Date()
		sSQL = "SELECT DISTINCT cpnWorkingName FROM coupons LEFT OUTER JOIN cpnAssign ON coupons.cpnID=cpnAssign.cpaCpnID WHERE cpnNumAvail>0 AND cpnEndDate>="&datedelim&DatePart("m",tdt) & "/" & DatePart("d",tdt) & "/" & DatePart("yyyy",tdt)&datedelim&" AND cpnIsCoupon=0 AND "
		sSQL = sSQL & "((cpnSitewide=1 OR cpnSitewide=2) "
		sSQL = sSQL & "OR (cpnSitewide=0 AND cpaType=2 AND cpaAssignment='"&rs("pID")&"') "
		sSQL = sSQL & "OR (cpnSitewide=0 AND cpaType=1 AND cpaAssignment IN ('"&Replace(topsectionids,",","','")&"')))"
		Session.LCID = saveLCID
		rs2.Open sSQL,cnn,0,1
		do while NOT rs2.EOF
			alldiscounts = alldiscounts & rs2("cpnWorkingName") & "<br>"
			rs2.MoveNext
		loop
		rs2.Close
	end if
	if usedetailbodyformat=1 OR usedetailbodyformat="" then %><b><font color="#FFFFFF">
</font></b></font>
            <table width="<%=innertablewidth%>" border="0" cellspacing="<%=innertablespacing%>" cellpadding="<%=innertablepadding%>" bgcolor="<%=innertablebg%>">
              <tr> 
                <td width="100%" colspan="4"> 
                  <p><font color="#FFFFFF" face="Times New Roman"><b><% if showproductid=true then response.write "<b>" & xxPrId & ":</b> " & rs("pID") & "<br>" %><%=rs("pName")&xxDot%><% if alldiscounts<>"" then response.write " <font color=""#FF0000""><strong>"&xxDsApp&"</strong><br><font size=""1"">" & alldiscounts & "</font></font>" %></b></font></p>
                </td>
              </tr>
              <tr> 
                <td width="100%" colspan="4" align="center" valign="middle"> <% if NOT (Trim(rs("pLargeImage"))="" OR IsNull(rs("pLargeImage")) OR Trim(rs("pLargeImage"))="prodimages/") then %><b><font color="#FFFFFF" face="Times New Roman">
                </font></b><b><font color="#FFFFFF" face="Times New Roman"> 
                  <img src="<%=rs("pLargeImage")%>" border="0" alt="<%=Replace(rs("pName"),"""","&quot;")%>"> <% elseif NOT (Trim(rs("pImage"))="" OR IsNull(rs("pImage")) OR Trim(rs("pImage"))="prodimages/") then %> 
                  <img src="<%=rs("pImage")%>" border="0" alt="<%=Replace(rs("pName"),"""","&quot;")%>"> <% else %> &nbsp; <% end if %>
                </font></b> 
                </td>
              </tr>
              <tr> 
                <td width="100%" colspan="4"> 
                  <p><b><font color="#FFFFFF" face="Times New Roman"><% shortdesc = Trim(rs("pDescription"))
				longdesc = Trim(rs("pLongDescription"))
				if longdesc<>"" then
					response.write longdesc
				elseif shortdesc<>"" then
					response.write shortdesc
				else
					response.write "&nbsp;"
				end if %></font></b></p>