Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old January 6th, 2007, 04: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!

Reply With Quote
  #2 (permalink)  
Old January 6th, 2007, 08:16 AM
Imar's Avatar
Wrox Author
Points: 65,660, Level: 100
Points: 65,660, Level: 100 Points: 65,660, Level: 100 Points: 65,660, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 15,962
Thanks: 64
Thanked 1,349 Times in 1,329 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.
Reply With Quote
  #3 (permalink)  
Old January 8th, 2007, 09: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

Reply With Quote
  #4 (permalink)  
Old January 8th, 2007, 01:50 PM
Imar's Avatar
Wrox Author
Points: 65,660, Level: 100
Points: 65,660, Level: 100 Points: 65,660, Level: 100 Points: 65,660, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 15,962
Thanks: 64
Thanked 1,349 Times in 1,329 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.
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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



All times are GMT -4. The time now is 08:31 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.