dcsimg
www.webdeveloper.com
Results 1 to 4 of 4

Thread: shopping carts..

Hybrid View

  1. #1
    Join Date
    Oct 2004
    Posts
    17

    shopping carts..

    I am building an asp.NET application and am going to need a shopping cart feature on my site. Before I attempt to do this, I was wondering if anyone could provide some helpful links/models that might assist me in doing this. I ask because I'm new to asp.NET and I anticipate that I'm going to have a hard time creating this.

    Thanks

  2. #2
    Join Date
    Jan 2004
    Location
    Melbourne, Australia
    Posts
    5,298
    We actually have a forum for ASP.NET questions. I will copy this thread over there and someone can point you in the right direction.

    Regards.

  3. #3
    Join Date
    Jul 2004
    Posts
    300
    I'd suggest reading up on ASP.NET because some things you try to do there are probably much easier ways to do them. If not, I'd look into databinding and authentication as primary points.

  4. #4
    Join Date
    Oct 2004
    Posts
    17
    I've been using this site
    http://www.sitepoint.com/article/net...t-datatables/2
    as a starting point to help me build this shopping cart.. I've ran into a problem. I can successfully add one row to the shopping cart, but when I go back to attempt to add a second row, it simply overwrites the first and displays only one row with the last product I added to the cart. I think it may have something to do with storing the data table in the session. Maybe you will be able to see something I'm overlooking.


    If Not IsPostBack Then
    makeCart()
    End If



    'check if the customer is adding something to the cart or just browsing
    Dim AddCheck As Integer = CType(Session.Item("CallAdd"), Integer)

    If AddCheck = 1 Then

    Dim part As Integer = CType(Session.Item("partAdd"), Integer)
    Dim quant As Integer = CType(Session.Item("quanadd"), Integer)

    objDT = Session("Cart")
    Dim Product = part

    objDR = objDT.NewRow
    objDR("Quantity") = quant
    objDR("Product") = Product
    objDR("Cost") = 69
    objDT.Rows.Add(objDR)
    Session("Cart") = objDT

    shopGrid.DataSource = objDT
    shopGrid.DataBind()
    AddCheck = 0
    End If
    End Sub

    Private Sub makeCart()
    objDT = New System.Data.DataTable("Cart")
    objDT.Columns.Add("ID", GetType(Integer))
    objDT.Columns("ID").AutoIncrement = True
    objDT.Columns("ID").AutoIncrementSeed = 1

    objDT.Columns.Add("Quantity", GetType(Integer))
    objDT.Columns.Add("Product", GetType(String))
    objDT.Columns.Add("Cost", GetType(Decimal))

    Session("Cart") = objDT

    End Sub

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles