473,574 Members | 2,625 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

shopping cart concept

Hi, beginner on asp.net 2.0 C# VS 2005, how can I use the shopping cart
concept on my application? When the user clicks add item, it will be stored
on some storage format, I dont know what is the term: temp/global DataSet,
etc... and it should be read on other web-form to checkout the items...

Can you point me to the right direction?

Thank you very much!
Jun 27 '08 #1
3 2887
"Paulo" <er********@ter ra.com.brwrote in message
news:%2******** ********@TK2MSF TNGP06.phx.gbl. ..
Hi, beginner on asp.net 2.0 C# VS 2005, how can I use the shopping cart
concept on my application? When the user clicks add item, it will be
stored on some storage format, I dont know what is the term: temp/global
DataSet, etc... and it should be read on other web-form to checkout the
items...
Basically, you have several choices depending on how you've designed your
web app, and what resources you have at your disposal...

As you've discovered, the information in the shopping cart needs to be
persisted (i.e. "remembered ") across multiple pages. Therefore, you can't
use ViewState. However, it's vital that different concurrent users don't get
their shopping carts mixed up, so you can't use the Application object
either.

Does your web app use a back-end database? If so, then you can use that to
store the shopping cart. This will also have the advantage that users could
"save" their cart and come back to it later. Some people like to offer this
facility...

Alternatively, even if your web app does use a database, you might prefer to
persist the cart information in the Session object. This is very simple to
do. Obviously, if you use the Session object, then any information stored in
it will be lost when the Session ends either because the user has logged out
and you've torn down the Session in code, or because it has timed out...

A third alternative would be to store the cart data in a cookie. However,
this would obviously not work if the user has disabled cookies in their
browser - some users do this for (supposed) security reasons.

Personally, I use the Session object for shopping cart. I use a
Dictionary<int, intgeneric for this. The Dictionary is keyed on the
product's unique identifier, and the value is the number of items purchased.
This has the advantage of keeping the object persisted in Session as small
as possible.
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Jun 27 '08 #2
Mark, what do you think about this solution? Good or bad?

http://www.sitepoint.com/article/net...art-datatables

Thank you very much!

"Mark Rae [MVP]" <ma**@markNOSPA Mrae.netescreve u na mensagem
news:e6******** ******@TK2MSFTN GP02.phx.gbl...
"Paulo" <er********@ter ra.com.brwrote in message
news:%2******** ********@TK2MSF TNGP06.phx.gbl. ..
>Hi, beginner on asp.net 2.0 C# VS 2005, how can I use the shopping cart
concept on my application? When the user clicks add item, it will be
stored on some storage format, I dont know what is the term: temp/global
DataSet, etc... and it should be read on other web-form to checkout the
items...

Basically, you have several choices depending on how you've designed your
web app, and what resources you have at your disposal...

As you've discovered, the information in the shopping cart needs to be
persisted (i.e. "remembered ") across multiple pages. Therefore, you can't
use ViewState. However, it's vital that different concurrent users don't
get their shopping carts mixed up, so you can't use the Application object
either.

Does your web app use a back-end database? If so, then you can use that to
store the shopping cart. This will also have the advantage that users
could "save" their cart and come back to it later. Some people like to
offer this facility...

Alternatively, even if your web app does use a database, you might prefer
to persist the cart information in the Session object. This is very simple
to do. Obviously, if you use the Session object, then any information
stored in it will be lost when the Session ends either because the user
has logged out and you've torn down the Session in code, or because it has
timed out...

A third alternative would be to store the cart data in a cookie. However,
this would obviously not work if the user has disabled cookies in their
browser - some users do this for (supposed) security reasons.

Personally, I use the Session object for shopping cart. I use a
Dictionary<int, intgeneric for this. The Dictionary is keyed on the
product's unique identifier, and the value is the number of items
purchased. This has the advantage of keeping the object persisted in
Session as small as possible.
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Jun 27 '08 #3
"Paulo" <er********@ter ra.com.brwrote in message
news:uQ******** ******@TK2MSFTN GP04.phx.gbl...

[top-posting corrected]
>Personally, I use the Session object for shopping cart. I use a
Dictionary<int , intgeneric for this. The Dictionary is keyed on the
product's unique identifier, and the value is the number of items
purchased. This has the advantage of keeping the object persisted in
Session as small as possible.

Mark, what do you think about this solution? Good or bad?

http://www.sitepoint.com/article/net...art-datatables
I'm sure it will work...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Jun 27 '08 #4

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

Similar topics

2
2849
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...
2
3300
by: Paul Bruneau | last post by:
Hi, I hope someone can help me make a working shopping cart, as a learning tool. If I have a "Product Demo" html page with a "Buy Me" button, there must be a simple javascript method of storing the necessary product information. There could be several fields involved... Then there ought to be another javascript method that can create...
1
3568
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
3209
by: Adil Akram | last post by:
I have created a site shopping cart in ASP.net. I am using ASP session object's SessionID on non SSL connection to track session. While adding products to cart DB I insert product and SessionID in table. All products and cart status pages are on non SSL connection. On checkout to get secure user information I shifted connection to SSL but...
2
2285
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...
7
2622
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 <%@...
1
7276
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)) {...
15
4272
gregerly
by: gregerly | last post by:
Hello, I once again turn to this community of genius' for some help with a problem. I've got a shopping cart (which is working well so far) that I will be implementing all kinds of AJAX functionality on. However, first I want to make sure it works if javascript is not available. So when your on the shopping cart page, you can update the...
1
7660
by: BenKen | last post by:
Hi all pls I'm having great difficulty in making my shopping cart work. I am a newbie in php with little understanding of it. Add to cart button doesn't work and shopping cart in general doesn't. Pls help. Below is the code for both shopping cart, products and function.php shopping cart code: <? include("db.php");...
0
7808
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...
0
7732
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...
0
8243
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...
1
7822
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8101
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6456
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...
0
3754
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1347
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1062
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...

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.