473,769 Members | 6,799 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1244
"Cirene" <ci****@nowhere .comwrote in message
news:%2******** ********@TK2MSF TNGP06.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**@markNOSPA Mrae.netwrote in message
news:%2******** ********@TK2MSF TNGP04.phx.gbl. ..
"Cirene" <ci****@nowhere .comwrote in message
news:%2******** ********@TK2MSF TNGP06.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**@markNOSPA Mrae.netwrote in message
news:%2******** ********@TK2MSF TNGP04.phx.gbl. ..
"Cirene" <ci****@nowhere .comwrote in message
news:%2******** ********@TK2MSF TNGP06.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******** ******@TK2MSFTN GP05.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**@markNOSPA Mrae.netwrote in message
news:%2******** *******@TK2MSFT NGP05.phx.gbl.. .
"Cirene" <ci****@nowhere .comwrote in message
news:O4******** ******@TK2MSFTN GP05.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
3034
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 and works good. I need to create a shopping cart in ASP and any useful info or tips would be helpful. Thanks. Erik Roessing
2
2868
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 im going. Just a couple of hints will do, Im familiar with vb script but not java based code , and im wondering how to store what they select so I can move around different product ranges. Don
1
3581
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 be able to come along and add it to their shopping cart. thanks joy
1
1822
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
2301
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 screen generation routines (already written) that take an XML stream as input from various "search for products" forms. That way I can run queries in one window and display the dynamic results in another. The searching functions will probably
7
2636
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 like it to work properly so that a record count counts through all the books and genertates these numbers. watch out for line breaks <%@ Language=VBScript %> <% Option Explicit %> <!--#include file="DatabaseConnect.asp"-->
3
4434
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 cookie, but cookie only stores string values, which makes it tricky to update/remove cart item values because i'd have to so substring, split, etc... What i'm thinking now is to store the cart in a database table, and just add a cookie with...
1
7299
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 <? require_once('functions.inc.php'); session_start(); do_html_header("Checkout"); $cart = $_SESSION; if($cart&&array_count_values($cart)) { display_cart($cart,false,0); display_checkout_form($HTTP_POST_VARS);
3
1264
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 - <link removed> is the main site, as soon as I have the shop running, it will be linked. My problem is on the shop <link removed> I have a cart running now that is available, but I need to add TWO drop down menus - basically one for which COLOR...
0
9590
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9424
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10051
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8879
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7413
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5448
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3968
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3571
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.