Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6
This is the forum to discuss the Wrox book ASP.NET 2.0 Instant Results by Imar Spaanjaars, Paul Wilton, Shawn Livermore; ISBN: 9780471749516
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 6th, 2007, 05:19 AM
saf saf is offline
Authorized User
 
Join Date: Nov 2006
Location: , , .
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Default add multiple items to cart

Hoping someone can point me in the right direction...

I'm trying to modify the Webshop application. I don't necessarity need to maintain an active shopping cart throughout the session. I want to display a list of available products, each with an editable quantity field. The user will enter the quantity of each item they want to order then add all the products to the database at one time (I could potentially have anywhere from 100-300 different items added at a time). I'm struggling with a few things:

1) I know this one should be easy but I've been struggling for days... I can't figure out the code to add multiple items (orderedProducts) to the cart at one time.

2) Since I will have so many products being ordered at one time, will I take a performance hit by adding them to a 'cart' in memory before finalizing the order? If so, instead of adding them to a 'cart' I can just add them to the database - I would still want to show the user their order and allow them to make changes during the current session, then just update the database again before final confirmation of order.

Thanks!

 
Old January 6th, 2007, 09:16 AM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there:

1. You can call ShopManager.AddProductToCart multiple times, each time passing a single product to it.
Alternatively, you could write an overload for AddProductToCart that accepts a List (Of Product) or an Array of Products and adds them to the cart.

2. Products are very light weight objects; you need to store a whole lot of products in the cat before you'd notice memory issues.
However, if you're worried about that, you could store the cart in the Profile. You can define a property of type ShoppingCart in the web.config and the shopping cart can then be saved in the database through the Profile feature of ASP.NET.

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.
 
Old January 8th, 2007, 10:57 AM
saf saf is offline
Authorized User
 
Join Date: Nov 2006
Location: , , .
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for the quick response Imar
saf

 
Old January 8th, 2007, 02:50 PM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

You're welcome. Did it help? What method did you choose?

Imar
---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.




Similar Threads
Thread Thread Starter Forum Replies Last Post
how to EDIT,delete,add,items in my database zedekiah BOOK: Beginning ASP 3.0 2 May 15th, 2008 08:16 AM
add to cart error haines BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 0 March 17th, 2008 05:49 PM
Instant Results - Add SubMenu Items jvm2552 ASP.NET 2.0 Professional 1 September 4th, 2007 01:13 PM
Add Items Chacko Visual C++ 0 April 5th, 2007 12:42 PM
Add to Cart Error: Object not set as an instance damartman All Other Wrox Books 0 June 27th, 2003 05:45 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.