Visualizzazione dei risultati da 1 a 8 su 8

Discussione: Carrello - problemino

  1. #1

    Carrello - problemino

    Ciao a tutti,

    Vi spiego in breve il mio problema:

    Ho una pagina di ricerca dove si visualizza a lato il carrello prodotti.
    Se io non includo il carrello nella pagina, quando il cliente clicca sul prodotto mi appare la pagina del carrello e funziona tranquillamente, ma se io includo la pagina carrello in quella della ricerca allora non funziona...
    Se clicco sopra il prodotto non mi aggiunge niente anzi mi da sempre la scritta: non ci sono prodotti nel tuo carrello.
    Non capisco il perchè?
    Avete qualche idea???
    è un problema al quale non ne vengo a capo perchè non mi da errore...
    :metallica
    Che cosa vuoi che ti dica???
    Senti che bel rumore...

  2. #2
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,559
    Credevo di aver capito ma non ho capito...

    roby

  3. #3
    controlla l'rs
    cioè se l'apertura del database è identica a quelle del motore di ricerca,c'e' un conflitto di query
    se posti il codice uno te lo dice
    http://www.danguru.com
    -------------------------
    http://www.mambo.it

  4. #4
    Allora questo è il carrello:
    Faccio il controllo del prodotto:

    <%

    Set Con = Server.CreateObject( "ADODB.Connection" )
    Con.Open "xxx"


    IF productid <> "" THEN
    sqlString = "SELECT cart_id FROM cart " &_
    "WHERE cart_userID=" & userID & " " &_
    "AND cart_productID='" & PID & "'"
    SET RS = Con.Execute( sqlString )
    IF RS.EOF THEN
    sqlString = "INSERT INTO cart ( " &_
    "cart_userID, " &_
    "cart_prezzo, " &_
    "cart_productID, " &_
    "cart_quantity " &_
    ") VALUES ( '" &_
    userID & "', '" &_
    PREZZO & "', '" &_
    PID & "', 1 )"
    ELSE
    sqlString = "UPDATE cart SET " &_
    "cart_quantity=cart_quantity+1 " &_
    "WHERE cart_id=" & RS( "cart_id" )
    END IF
    RS.Close
    SET RS = Nothing

    Con.Execute sqlString
    END IF


    IF Request( "updateQ" ) <> "" THEN
    SET RS = Server.CreateObject( "ADODB.Recordset" )
    RS.ActiveConnection = Con
    RS.CursorType = adOpenDynamic
    RS.LockType = adLockOptimistic
    sqlString = "SELECT cart_id, cart_quantity FROM cart " &_
    "WHERE cart_userID=" & userID
    RS.Open sqlString
    WHILE NOT RS.EOF
    newQ = TRIM( Request( "pq" & RS( "cart_id" ) ) )
    IF newQ = "" OR newQ = "0" THEN
    RS.Delete
    ELSE
    IF isNumeric( newQ ) THEN
    RS( "cart_quantity" ) = newQ
    END IF
    END IF
    RS.MoveNext
    WEND
    RS.Close
    SET RS = Nothing
    END IF
    %>

    Qui stampo a video il carrello



    <%
    IF register <> "" AND error = "" THEN
    addUser
    END IF

    dati = checkpassword( userID, psw, Con )

    IF dati <> "" THEN
    %>
    <%

    sqlString = "SELECT cart.cart_id, t_ListinoSelect.Item_Name, t_ListinoSelect.Part_Number, " &_
    "cart.cart_quantity, " &_
    "cart.cart_prezzo " &_
    "FROM cart INNER JOIN t_ListinoSelect ON cart.cart_productID = t_ListinoSelect.ID " &_
    "WHERE cart.cart_userID= " & userID & " " &_
    "ORDER BY cart_id DESC"


    SET RS = Con.Execute( sqlString )

    IF RS.EOF THEN
    %>
    </font>
    <font color="#006699" face="Verdana">Non ci sono prodotti nel tuo

    prospetto offerte</font>

    <%
    ELSE
    orderTotal = 0
    %>
    <form method="post" action="ricercagenerale.asp">
    <input name="updateQ" type="hidden" value="1">
    <input name="userID" type="hidden" value="<%=userID%>">
    <input name="psw" type="hidden" value="<%=psw%>">
    <input name="RAG_SOCIALE" type="hidden" value="<%=RAG_SOCIALE%>">
    <input type="hidden" name="Level" value="<%=request( "Level" ) %>" />
    <input type="hidden" name="c_server" value="<%=request( "C_SERVER" ) %>" />
    <input type="hidden" name="c_applic" value="<%=request( "C_applic" ) %>" />
    <input type="hidden" name="c_sistemi" value="<%=request( "C_Sistemi" ) %>" />
    <input type="hidden" name="Pool" value="SYSTEMS" />
    <input type="hidden" name="SCONTO" value="<%=request( "SCONTO" ) %>" />
    <input type="hidden" name="Purchase_Period" value="<%=request( "Purchase_Period" ) %>" />

    <%
    WHILE NOT RS.EOF
    dim ordertotal
    orderTotal = (orderTotal + ( RS( "cart_prezzo" ) * RS( "cart_quantity" ) ))
    %>

    <font size="1" face="Verdana">
    <%=RS( "Item_Name" )%>
    </font>

    <font size="1" face="Verdana">
    € <%=RS( "cart_prezzo" )%>
    </font>
    -
    <font size="1" face="Verdana">
    <input name="pq<%=RS( "cart_id" )%>" type="text" size=4
    value="<%=RS( "cart_quantity" )%>">
    </font>

    <%
    RS.MoveNext
    WEND
    %>

    <font face="Verdana" size="2" color="#FF0000">Totale ordine:</font>
    <font face="Verdana" size="2" color="#FF0000">
    € <%=( orderTotal )%>
    </font>
    <table border="0">
    <tr>
    <td align="right">
    <input type="submit" value="Aggiorna"></form>
    </td>
    <td>
    <form method="post" action="deletecart.asp">
    <input type="hidden" name="userID" value="<%=request( "userID" ) %>" />
    <input type="hidden" name="psw" value="<%=request( "psw" ) %>" />
    <input type="submit" value="Svuota">
    </form>
    </td>
    </tr>
    </table>
    <% END IF %>
    <% ELSE %>

    <%
    END IF
    %>
    :metallica
    Che cosa vuoi che ti dica???
    Senti che bel rumore...

  5. #5
    Adesso ti posto la pagina di ricerca:
    If Request.QueryString("page") = "" Then
    iPageCurrent = 1
    Else
    iPageCurrent = CInt(Request.QueryString("page"))
    End If

    strSQL = "select t_ListinoSelect.*, (Int((t_ListinoSelect.Retail_Price - ( t_ListinoSelect.Retail_Price * "& nSCONTO &" ))*100)+1)/100 AS PREZZO from t_ListinoSelect where Level LIKE '%" & c_server & "%' AND Pool LIKE 'Servers' AND Language LIKE '%" & Language & "%' AND Item_Name LIKE '%" & Item_Name & "%'AND Product_Type LIKE '%" & Product_Type & "%' AND Part_Number LIKE '%" & Part_Number & "%' AND (Purchase_Period LIKE '%" & Purchase_Period & "%' OR Purchase_Period LIKE '%Non-Specific%') union select t_ListinoSelect.*, (Int((t_ListinoSelect.Retail_Price - ( t_ListinoSelect.Retail_Price * "& nSCONTO &" ))*100)+1)/100 AS PREZZO from t_ListinoSelect where Level LIKE '%" & c_applic & "%' AND Pool LIKE 'Applications' AND Language LIKE '%" & Language & "%' AND Item_Name LIKE '%" & Item_Name & "%'AND Product_Type LIKE '%" & Product_Type & "%' AND Part_Number LIKE '%" & Part_Number & "%' AND (Purchase_Period LIKE '%" & Purchase_Period & "%' OR Purchase_Period LIKE '%Non-Specific%') union select t_ListinoSelect.*, (Int((t_ListinoSelect.Retail_Price - ( t_ListinoSelect.Retail_Price * "& nSCONTO &" ))*100)+1)/100 AS PREZZO from t_ListinoSelect where Level LIKE '%" & c_sistemi & "%' AND Pool LIKE 'Systems' AND Language LIKE '%" & Language & "%' AND Item_Name LIKE '%" & Item_Name & "%'AND Product_Type LIKE '%" & Product_Type & "%' AND Part_Number LIKE '%" & Part_Number & "%' AND (Purchase_Period LIKE '%" & Purchase_Period & "%' OR Purchase_Period LIKE '%Non-Specific%')"

    Set objRS = Server.CreateObject("ADODB.Recordset")
    objRS.PageSize = iPageSize
    objRS.CacheSize = iPageSize
    objRS.Open strSQL, objConn, adOpenStatic, adLockReadOnly, adCmdText

    'response.write strsql:response.end
    reccount = objRS.recordcount
    iPageCount = objRS.PageCount
    'varsconto = CLng(objRS("Estimated Retail Price")) - (CLng(objRS("Estimated Retail Price")) * CLng(SCONTO) /100)

    If iPageCurrent > iPageCount Then iPageCurrent = iPageCount
    If iPageCurrent < 1 Then iPageCurrent = 1

    If iPageCount = 0 Then
    Response.Write "

    <table><td><font face='verdana' size='2' color='#000000'>Non sono stati trovati i Prodotti.</td></table></p>"
    Else
    objRS.AbsolutePage = iPageCurrent
    iRecordsShown = 0
    %>
    <table cellpadding="0" cellspacing="0" border="0" width="100%">
    <tr>
    <td bgcolor="#cccccc">
    <table cellpadding="2" cellspacing="1" border="0" width="100%">
    <tr height="22">
    <td bgcolor="#dddddd" WIDTH="1%"><font face="verdana" size="2" color="#000000"></font></td>
    <td bgcolor="#dddddd" WIDTH="43%"><font face="verdana" size="2" color="#000000">Prodotto</font></td>
    <td bgcolor="#dddddd" WIDTH="9%" align="center"><font face="verdana" size="2" color="#000000">Codice</font></td>
    <td bgcolor="#dddddd" WIDTH="14%" align="center"><font face="verdana" size="2" color="#000000">Product Type</font></td>
    <td bgcolor="#dddddd" WIDTH="13%" align="center"><font face="verdana" size="2" color="#000000">Lingua</font></td>
    <td bgcolor="#dddddd" WIDTH="8%" align="center"><font face="verdana" size="2" color="#000000">Prezzo Listino</font></td>
    <td bgcolor="#dddddd" WIDTH="27%" align="center"><font face="verdana" size="2" color="#000000">Prezzo Riservato</font></td>
    </tr>
    <%
    'SI VISUALIZZA IL CONTENUTO DELLA STRINGA SQL
    'ALL'INTERNO DELLA TABELLA PRIMA DEFINITA
    cont=1
    Do While iRecordsShown < iPageSize And Not objRS.EOF
    Dim Rig, bg
    Rig = Rig + 1
    If Rig Mod 2 = 0 then
    bg = "#E4E4E4"
    Else
    bg = "#ffffff"
    End if

    Response.Write "<tr bgcolor = " & bg & "><td><font color='#000000' face='Verdana' size='1'>" & (iPageSize*iPageCurrent)-iPageSize+Cont & "</font></td>"
    Response.Write "<td><font color='#000000' face='Verdana' size='1'>" & objRS("Item_Name") & "<form method='get' name='Prodotto' action='ricercagenerale.ASP'><input type='hidden' name='userID' value="&userID&" /><input type='hidden' name='SCONTO' value="&sconto&" /><input type='hidden' name='c_applic' value="&c_applic&" /><input type='hidden' name='psw' value="&psw&"><input type='hidden' name='PID' value="&objRS("ID")&"><input type='hidden' name='prezzo' value= "&objRS("prezzo")&"><input type='hidden' name='level' value="&Level&"><input type='hidden' name='Pool' value="&Pool&"><input type='hidden' name='nSconto' value="&nSconto&"><input type='image' src='Images/vai_small.gif' name='Submit' value='vai' alt='vai' ></form></font></td>"
    Response.Write "<td align='center'><font color='#000000' face='Verdana' size='1'>" & objRS("Part_Number") & "</font></td>"
    Response.Write "<td align='center'><font color='#000000' face='Verdana' size='1'>" & objRS("Product_Type") & "</font></td>"
    Response.Write "<td align='center'><font color='#000000' face='Verdana' size='1'>" & objRS("Language") & "</font></td>"
    Response.Write "<td align='center'><font color='#000000' face='Verdana' size='1'> € " & objRS("Retail_Price") & "</font></td>"
    Response.Write "<td align='center'><font color='#000000' face='Verdana' size='1'>€ " & objRS("PREZZO") & "</font></td>"
    Cont = Cont + 1
    'POSIZIONAMENTO ALLA RIGA SUCCESSIVA DEL DB
    iRecordsShown = iRecordsShown + 1
    objRS.MoveNext
    Loop
    'PULIZIA DEGLI OGGETTI ADO
    objRS.Close
    Set objRS = Nothing
    %>
    </table>
    </td>
    </tr>
    </table>
    <%End if%>



    <%If ipagecount <> 1 Then%>
    <center>
    <table>
    <tr valign="middle">
    <td width="50%" align="center" valign="middle"><font face="verdana" size="1" color="#000000">
    [
    <%if iPageCurrent-2 > 0 and iPageCurrent > 2 then%>
    &c_applic=<%=Request("c_applic")%>&c_server=<%=Req uest("c_server")%>&Item_Name=<%=Request("Item_Name ")%>&Language=<%=Request("Language")%>&Product_Typ e=<%=Request("Product_Type")%>&Part_Number=<%=Requ est("Part_Number")%>&Purchase_Period=<%=Request("P urchase_Period")%>&SCONTO=<%=Request("SCONTO")%>&N UM_CONTRATTO=<%=Request("NUM_CONTRATTO")%>&P_IVA=< %=Request("P_IVA")%>">[img]images/first.gif[/img]
    <%end if%>
    <%if iPageCurrent > 1 then%>
    &c_applic=<%=Request("c_applic")%>&c_server=<%=Req uest("c_server")%>&Item_Name=<%=Request("Item_Name ")%>&Language=<%=Request("Language")%>&Product_Typ e=<%=Request("Product_Type")%>&Part_Number=<%=Requ est("Part_Number")%>&Purchase_Period=<%=Request("P urchase_Period")%>&SCONTO=<%=Request("SCONTO")%>&N UM_CONTRATTO=<%=Request("NUM_CONTRATTO")%>&P_IVA=< %=Request("P_IVA")%>">[img]images/pre.gif[/img]
    <%end if%>
    <%if iPageCount > 2 then
    if iPageCurrent-2 < 1 then da_pag = 1 else da_pag = iPageCurrent-2
    if iPageCurrent+2 > iPageCount then fino_a_pag = iPageCount else fino_a_pag = iPageCurrent+2
    else
    da_pag = 1
    fino_a_pag = iPageCount
    end if%>
    <%for i = da_pag to fino_a_pag%>
    <%if i = iPageCurrent then%>
    <font color="red"><%=i%></font>
    <%else%>
    &c_applic=<%=Request("c_applic")%>&c_server=<%=Req uest("c_server")%>&Item_Name=<%=Request("Item_Name ")%>&Language=<%=Request("Language")%>&Product_Typ e=<%=Request("Product_Type")%>&Part_Number=<%=Requ est("Part_Number")%>&Purchase_Period=<%=Request("P urchase_Period")%>&SCONTO=<%=Request("SCONTO")%>&u serID=<%=Request("userID")%>&psw=<%=Request("psw") %>"><%=i%>
    <%end if%>
    <%next%>
    <%if iPageCurrent > 0 and iPageCurrent < iPageCount then%>
    &c_applic=<%=Request("c_applic")%>&c_server=<%=Req uest("c_server")%>&Item_Name=<%=Request("Item_Name ")%>&Language=<%=Request("Language")%>&Product_Typ e=<%=Request("Product_Type")%>&Part_Number=<%=Requ est("Part_Number")%>&Purchase_Period=<%=Request("P urchase_Period")%>&SCONTO=<%=Request("SCONTO")%>&u serID=<%=Request("userID")%>&psw=<%=Request("psw") %>">[img]images/next.gif[/img]
    <%end if%>
    <%if iPageCurrent+1 < iPageCount then%>
    &c_applic=<%=Request("c_applic")%>&c_server=<%=Req uest("c_server")%>&Item_Name=<%=Request("Item_Name ")%>&Language=<%=Request("Language")%>&Part_Number =<%=Request("Part_Number")%>&Purchase_Period=<%=Re quest("Purchase_Period")%>&SCONTO=<%=Request("SCON TO")%>&userID=<%=Request("userID")%>&psw=<%=Reques t("psw")%>">[img]images/last.gif[/img]
    <%end if%>
    ]

    </font></td>
    </tr>
    <tr>
    <td colspan="2" align="center"><font face="verdana" size="1" color="#000000">
    <center>
    Pagina
    <font color="#FF0000"><%=iPageCurrent%></font>
    di
    <font color="#FF0000"><%=iPageCount%></font>
    </center>
    </font></td>
    </tr>
    </table>
    </center>
    <%end if%>
    <%
    objConn.Close
    Set objConn = Nothing
    %>
    NOn uso lo stesso recordset...
    Poi scusa se usassi lo stesso recordset mi darebbe almeno errore invece non me lo da...
    Alla ine se avessi un errore saprei come muovermi...
    :metallica
    Che cosa vuoi che ti dica???
    Senti che bel rumore...

  6. #6
    Da quello che leggo penso che sia un problema solo di form
    prova a mettere come metodo il GET e quando vuoi aggiornare il carrello vedi che pagina e che richieste fà,purtroppo il codice è lungo,dovresti fare delle prove,perlomeno così io faccio
    http://www.danguru.com
    -------------------------
    http://www.mambo.it

  7. #7
    Gia fatto e mi passa tutte le variabili che servono...
    Che casino..
    :metallica
    Che cosa vuoi che ti dica???
    Senti che bel rumore...

  8. #8
    Fammi capire ,allora ste due pagine aperte da sole funzionano ma insieme no giusto??
    Allora fai così prova a cambiare il carrello da RS in BS o qualc'osaltro ,
    prima di
    codice:
    IF RS.EOF THEN
    metti
    codice:
    RS.MOVEFIRST
    e riprova,cerca di smanettare il codice,purtroppo quando non da errori è un problema di conflitto con altre pagine
    http://www.danguru.com
    -------------------------
    http://www.mambo.it

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.