locked
SHOPPING CART RRS feed

  • Question

  • User669521406 posted

    I have created a shopping cart already, my problem is that i don't know how and WHERE to save the product of a particular user such that when he come  back he get the same item on his shopping cart? any idea or any help? i have already a database and the relationship is as follow, customer can place many order and an order has many orderline and a orderline is connected to product table

    Thursday, November 1, 2012 2:04 PM

Answers

  • User-1028151323 posted

    OPTION A

    Option A is exactly what I suggested earlier.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, November 2, 2012 6:48 AM
  • User208353478 posted

    hi..

    u can use  session state mangement technique to store the products info which a user ordered based on the unique session id at the server side and keep the session timeout to store secured information with in the time limit..

     

    thanks..

    if it suits ur requiremnt kindly mark as answer ...

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, November 2, 2012 9:50 AM

All replies

  • User-1028151323 posted

    Are you identifying the user by a login? If so every item they add to their "cart" store in a tempOrders table and then when they "checkout" you can move the data from the tempOrders table to the Orders table. I'd also leave the data in the tempOrders table until they complete the checkout process, then delete it.

    Thursday, November 1, 2012 2:57 PM
  • User669521406 posted

    the idea is that i should place the detail of the shopping cart in the orderline, as you say yes i'm using a login, but the main problem is where to save the data after the user click on check out and how to retrieve a user data if he logout before the checkout such that when he login again he gain the same data

    Thursday, November 1, 2012 3:28 PM
  • User-1028151323 posted

    As I said, each time the user selects an item to add to their cart, add it to a temp order table. It should be keyed to the userid so you can pull the data back when they log back in.

    Thursday, November 1, 2012 3:41 PM
  • User2144558116 posted

    Hi Jdaniel13,

       When the user clicks on checkout you will request the Creditcard information and create the order. Once the order is placed you will clear the items in the shopping cart for that user.

    Here is the flow of shopping cart.

    1. User browse a product

    2. Add that product to shopping cart --> You need to store this in the shopping cart table with the userid and quantity and any other details like price etc.

    3. User will continue to browse and add as many items to shopping cart.

    4. User clicks on Checout. At this point you will request for Credit card and shipping information.

    5. Once the Credit card authorization is successful, you will create the order and empty the shopping cart for that user.

    If the user closes the browser before step5, you dont need to do anything because the produt is already stored in the shopping cart table.

    If this is not what you are expecting then please provide your shopping cart flow, so we can help you.

    Thursday, November 1, 2012 3:43 PM
  • User669521406 posted

    So 

    For my shopping it is like that

    1. the user select a product from a dropdown list which has the different product 

    2. click on add and put the quantity and this is send to the shopping cart

    now c0me the problem

    i want to know, how will i save the data and where? because in my databse, there are  table name order, another orderline, product and customer.

    i think that the data in the shopping cart should be in the orderline but i'm not sure of that, can u help me on that?

    Thursday, November 1, 2012 3:49 PM
  • User669521406 posted

    Hello Prabakaran_r no need of credit card and so on just store the item and place order that all :)

    Thursday, November 1, 2012 3:51 PM
  • User2144558116 posted

    Hi Jdaniel13, Please note, shopping cart is a temporary means of storing the selected products till customer checkout. Records should be created in order table once the customer checkout.

    Based on your inputs till now, I can think of two options.

    Option A: (Cleaner approach)

    1) Create a new table and call it as ShoppingCart with three fields (CustomerId, ProductId, Quantity).
    2) When customer select a product from dropdown and enters the quantity, insert the customer, product and quantity to shoppingcart table.
    3) Once customer done with adding required products customer will click on Checkout button.
    4) Then, create a record in Order table. Insert all the items from shoppingcart table to orderline table. Then delete all the items in the shoppingcart table for that customer.

    Option B: (Quick and dirty approach)

    1) Add a boolean column named "IsCheckedout" in Order table.
    2) When customer select a product from dropdown and enters the quantity, insert a record in order table with IsCheckedOut = False. Also keep the order number in session for adding next items.
    3) Insert the selected product in orderline table.
    4) When the customer clicks on Checkout button after adding required products, just set the "IsCheckedOut" flag to true.
    Please note the following issues with Option B.

    I will choose Option A because it is cleaner approach and it keeps the shopping cart and order table separatly.

    Thursday, November 1, 2012 9:26 PM
  • User669521406 posted

    can u give me this relationship please?

    Friday, November 2, 2012 1:47 AM
  • User669521406 posted

    OPTION A

    Friday, November 2, 2012 1:48 AM
  • User669521406 posted

    i have already store the shopping cart in a session can i take the session and store the value in the order until the user checkout?

    Friday, November 2, 2012 1:51 AM
  • User669521406 posted

    If Session("Cart") Is Nothing Then
    Session.Add("Cart", New SortedList)
    End If
    Return CType(Session("Cart"), SortedList) this my session where i sort the current item while the user is still login in the website, i need to take all these item in this session store in it, in the order, then make the orderline

    Friday, November 2, 2012 2:10 AM
  • User2144558116 posted

    Refer one of your requirement below "i don't know how and WHERE to save the product of a particular user such that when he come  back he get the same item on his shopping cart?"

    If you need such functionality then you cannot store it in session. You need to store this in a Database table. If you keep the cart in session then when the user logoff or close the browser then you will lose the cart.

    Friday, November 2, 2012 5:31 AM
  • User-1028151323 posted

    OPTION A

    Option A is exactly what I suggested earlier.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, November 2, 2012 6:48 AM
  • User208353478 posted

    hi..

    u can use  session state mangement technique to store the products info which a user ordered based on the unique session id at the server side and keep the session timeout to store secured information with in the time limit..

     

    thanks..

    if it suits ur requiremnt kindly mark as answer ...

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, November 2, 2012 9:50 AM