Results 1 to 3 of 3

Thread: willingly to pay for solution

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2004
    Posts
    3

    willingly to pay for solution

    Willing to pay for the solution. Email me ur price. Me need this urgently.Problem as follow:
    done with the shopping cart thing, everything works okie except one thing, if the quantity is in textbox format and buyer can enter a number and click on a button to recalculate the prices and at the same time, store it into the dictionary. How can it be done? email me at [email protected]
    ===========================================
    <%
    Sub AddItemToCart(iItemID, iItemCount)
    If dictCart.Exists(iItemID) Then
    dictCart(iItemID) = dictCart(iItemID) + iItemCount
    Else
    dictCart.Add iItemID, iItemCount
    End If
    Response.Write "Product has been added to your cart.<BR><BR>" & vbCrLf
    End Sub
    Sub RemoveItemFromCart(iItemID, iItemCount)
    If dictCart.Exists(iItemID) Then
    Response.Write iItemCount
    If dictCart(iItemID) <= iItemCount Then
    dictCart.Remove iItemID
    Else
    dictCart(iItemID) = len(dictCart(iItemID)) - 1
    End If
    Response.Write iItemCount & " of item # " & iItemID & " have been removed from your cart.<BR><BR>" & vbCrLf
    Else
    Response.Write "Couldn't find any of that item your cart.<BR><BR>" & vbCrLf
    End If
    End Sub
    Sub ShowItemsInCart()
    Dim Key
    Dim aParameters ' as Variant (Array)
    Dim sTotal

    %>
    <TABLE Border=1 CellPadding=5 CellSpacing=0 class=black width=600>
    <TR>
    <TD width=100>Item #</TD>
    <TD width=100>Description</TD>
    <TD>Quantity</TD>
    <TD width=100>Remove From Cart</TD>
    <TD width=100>Price</TD>
    <TD width=100>Totals</TD>
    </TR>
    <%
    dim sqltemp
    dim category
    set rst5=Server.CreateObject("ADODB.Recordset")
    dim counterr
    dim totall
    totall = 0
    For Each Key in dictCart
    sqltemp="select * from Product where "
    sqltemp=sqltemp & "Product_id="
    sqltemp=sqltemp & "'"
    sqltemp=sqltemp & key
    sqltemp=sqltemp & "'"
    rst5.open sqltemp, connection
    counterr = len(dictCart(Key))
    totall = totall + (counterr * rst5("price"))
    %>
    <TR>
    <TD ALIGN="Center"><%= rst5("Product_ID") %></TD>
    <TD ALIGN="Left"><%=rst5("model")%></TD>
    <TD ALIGN="Center"><input size=3 type=textbox value="<%= counterr%>"></TD>
    <TD ALIGN="Left"><A HREF="add.asp?action=del&item=<%= Key %>&count=<%= dictCart(Key) %>">Remove</A></TD>
    <TD ALIGN="left">S$ <%= rst5("price") %></TD>
    <TD ALIGN="left">S$ <%=counterr * rst5("price")%></TD>
    </TR>
    <%
    rst5.close
    Next
    %>
    </tr><Tr><td colspan=5 align=right bgcolor=lightblue>Total</td><td align=left bgcolor=lightblue>S$ <%=totall%></td>
    </tr>
    </TABLE>
    <%
    End Sub
    %>


    <% ' ***** Begin the infamous runtime script *****
    ' Declare our Vars
    Dim dictCart ' as dictionary
    Dim sAction ' as string
    Dim iItemID ' as integer
    Dim iItemCount ' as integer

    ' Get a reference to the cart if it exists otherwise create it
    If IsObject(Session("cart")) Then
    Set dictCart = Session("cart")
    Else
    Set dictCart = Server.CreateObject("Scripting.Dictionary")
    End If

    ' Get all the parameters passed to the script
    sAction = Request.QueryString("action")
    iItemID = Request.QueryString("item")
    iItemCount = Request.QueryString("count")
    %>
    <TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 width=600>
    <TR><TD>
    <%
    ' Select action based on user input
    Select Case sAction
    Case "add"
    AddItemToCart iItemID, iItemCount
    ShowItemsInCart
    %>
    </TD></TR>
    <TR><TD ALIGN="right">
    <A HREF="<%=session("hpcat")%>">Continue Shopping</A>
    <A HREF="confirm.asp">Checkout</A><BR>
    <%
    Case "del"
    RemoveItemFromCart iItemID, iItemCount
    ShowItemsInCart
    %>
    </TD></TR>
    <TR><TD ALIGN="right">
    <A HREF="<%=session("hpcat")%>">Continue Shopping</A>
    <A HREF="confirm.asp">Checkout</A><BR>
    <%
    Case "viewcart"
    ShowItemsInCart
    %>
    </TD></TR>
    <TR><TD ALIGN="right">
    <A HREF="add.asp?action="><IMG SRC="./images/shop_look.gif" BORDER=0 WIDTH=46 HEIGHT=46 ALT="Continue Looking"></A>
    <A HREF="add.asp?action=checkout"><IMG SRC="./images/shop_checkout.gif" BORDER=0 WIDTH=46 HEIGHT=46 ALT="Checkout"></A><BR>
    <%
    Case "checkout"
    PlaceOrder
    %>
    </TD></TR>
    <TR><TD ALIGN="left">
    <BR>
    <H2>Thank you for your order!</H2>
    If this had been an actual shopping cart, this is where you would have had them enter
    their personal information and payment method and then taken care of any backend
    processing before finalizing their order. However as this is a shopping cart sample
    and this is where security becomes a problem, we'll leave it for a future sample.
    <%
    Case Else ' Shop
    ' ShowFullCatalog
    ShowItemsInCart
    %>
    </TD></TR>
    <TR><TD ALIGN="right">
    <A HREF="add.asp?action=viewcart"><IMG SRC="./images/shop_cart.gif" BORDER=0 WIDTH=46 HEIGHT=46 ALT="View Cart Contents"></A>
    <%
    End Select

    ' Return cart to Session for storage
    Set Session("cart") = dictCart
    %>
    </TD></TR>
    </TABLE>
    </BODY>
    </HTML>
    Good morning everyone, and in case I dun see u later, good afternoon,good evening and good night...zZzZz...

  2. #2
    Frenzied Member
    Join Date
    May 2003
    Location
    So Cal
    Posts
    1,564
    Try RentACoder website.

  3. #3
    Fanatic Member
    Join Date
    Aug 2003
    Posts
    601
    i dont understand what your doing, but from what i made out of it. i can give you some pseudo code, you need to update when you calculate instead of doing them seperately do them at same time.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width