473,408 Members | 2,839 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

Suggestions on storing shopping cart info

I am writing a shopping cart app in asp.net.

So far I created 2 classes, 1 for customer_info (name, address, email), 1
for product_info (prodname, price, description).

As the shopper adds things to the cart and navigates throught the site to
shop more, should I store this info in a session var? What is the typical
way? Should I create another class for cart and store an array of
product_info to keep track of what's in the cart, etc...?

What do you recommend?

Thanks
Aug 17 '08 #1
5 1229
"Cirene" <ci****@nowhere.comwrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl...
As the shopper adds things to the cart and navigates throught the site to
shop more, should I store this info in a session var?
That would work. Alternatively, if you want the customer to be able to save
the cart and come back to it later, you should save it to a database...
Should I create another class for cart and store an array of product_info
to keep track of what's in the cart, etc...?
That's what I do, though I tend to use a generic e.g. Dictionary<int, int>
to store the ID of the purchased product along with the number of items
purchased...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Aug 17 '08 #2
Thanks Mark, as usual. I'll give it a try...

"Mark Rae [MVP]" <ma**@markNOSPAMrae.netwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
"Cirene" <ci****@nowhere.comwrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl...
>As the shopper adds things to the cart and navigates throught the site to
shop more, should I store this info in a session var?

That would work. Alternatively, if you want the customer to be able to
save the cart and come back to it later, you should save it to a
database...
>Should I create another class for cart and store an array of product_info
to keep track of what's in the cart, etc...?

That's what I do, though I tend to use a generic e.g. Dictionary<int, int>
to store the ID of the purchased product along with the number of items
purchased...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Aug 17 '08 #3
Would using a generic list (of these objects) be the best way to handle this
in your opinion? Store that to a session var?

"Mark Rae [MVP]" <ma**@markNOSPAMrae.netwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
"Cirene" <ci****@nowhere.comwrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl...
>As the shopper adds things to the cart and navigates throught the site to
shop more, should I store this info in a session var?

That would work. Alternatively, if you want the customer to be able to
save the cart and come back to it later, you should save it to a
database...
>Should I create another class for cart and store an array of product_info
to keep track of what's in the cart, etc...?

That's what I do, though I tend to use a generic e.g. Dictionary<int, int>
to store the ID of the purchased product along with the number of items
purchased...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Aug 18 '08 #4
"Cirene" <ci****@nowhere.comwrote in message
news:O4**************@TK2MSFTNGP05.phx.gbl...

[please don't top-post]
>That's what I do, though I tend to use a generic e.g. Dictionary<int,
intto store the ID of the purchased product along with the number of
items purchased...

Would using a generic list (of these objects) be the best way to handle
this in your opinion? Store that to a session variable?
No it wouldn't, otherwise that's what I'd be doing. I've never found any
need to persist anything other than the ID of the item bought together with
the number of items purchased.
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Aug 18 '08 #5
But to perisist it using a session var doesn't using a List allow you to
easily access, add and remove items in the cart? Or should I just use an
arraylist of the cart items?

I was just looking at this and it seemed like a good idea...
http://www.java2s.com/Code/VB/Generi...nericClass.htm

By the way i'm not sure what "top-posting" is. I just hit "Reply to Group"
in Outlook Express. :)

"Mark Rae [MVP]" <ma**@markNOSPAMrae.netwrote in message
news:%2***************@TK2MSFTNGP05.phx.gbl...
"Cirene" <ci****@nowhere.comwrote in message
news:O4**************@TK2MSFTNGP05.phx.gbl...

[please don't top-post]
>>That's what I do, though I tend to use a generic e.g. Dictionary<int,
intto store the ID of the purchased product along with the number of
items purchased...

Would using a generic list (of these objects) be the best way to handle
this in your opinion? Store that to a session variable?

No it wouldn't, otherwise that's what I'd be doing. I've never found any
need to persist anything other than the ID of the item bought together
with the number of items purchased.
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Aug 18 '08 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Erik | last post by:
Does anybody know of a free ASP shopping cart or some free ASP code to help someone get a shopping cart started. Or does anybody have any experience using a ASP shopping cart that is inexpensive...
2
by: Don Grover | last post by:
I am retrieving costs and product id's from a sql db. and need to build a shopping cart around it. How do I store the selected items and qty req so I can move into another catalog and total up as...
1
by: madison | last post by:
Hi, I am trying to start a website using paypals shopping cart function. If i have 10 items and they sell out, how do I make it so the item is then listed as sold out. The next person would not...
1
by: Jia Sun | last post by:
hello , everybody , i need a similar program , just like fancyimport.com if possible, pls contact me ,thank you very much . inchina@gmail.com
2
by: G.E.M.P | last post by:
High Level Session Handling Design for a Shopping cart 0) What am I missing? 1) How does OSCommerce do it? I'm thinking about building a shopping cart from scratch, using a library of dynamic...
7
by: isaac2004 | last post by:
hi i have a basic asp page that acts as an online bookstore. on my cart page i am having trouble generating 3 numbers; a subtotal, a shipping total, and a final price. here is my code i would...
3
by: Milsnips | last post by:
Hi there, i had a small project where i used a session to store the shopping cart, but if it times out, the user loses the cart. Then i thought instead of using session, i'll store the cart in a...
1
by: jecha | last post by:
I'm implementing a shopping cart but am having a problem in checking out a person who has added item in his/her shopping busket.The code for the checkout.php script is given below <?...
3
by: craftycaps | last post by:
Ok, I'm so sorry, but I'm very new at this. So new in fact that I had a friend of mine integrate this shopping cart with my current online store. My site is up, but it is not linked yet to the shop...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.