Thursday, March 22, 2012

shopping cart, checkout and order completion

hey
i'm quite sure this doesnt belong here, but this is my first post and i don't know where else to put it

i have the following question
i just finished an asp.net class and we created a site that simulates a simple store without the actual payment, our teacher had us do it using session variables and cookies, mainly cookies though, he had the cart as a cookie in this format "1,3,4,6" the numbers being the itemID's of the items in the database, then when it came to checkout he was having a cookie for the quantities, which also followed the same pattern and the numbers corresponded to the items in the cart

is this a good way to do it, is it outdated? is it too much hassle, what else could be better?I think that you can use Hashtable for your shopping cart!

and then you can store two type variables in the session variables.

I think so!
Welcome to the ASP.NET forums, mgeney.

Umm ... even though the cart was a student exercise, I'd say it was ill-advised.

For one thing, cookies have a size limit. So, you really don't want to use cookies to store anything other than minimal information.

The cookie should probably store only one thing: the customer's ID number.

All the information about that customer's shopping cart can be persisted (saved) somewhere else. For example:

1) In a session variable. This might be okay for a student exercise, but you wouldn't want to do this in a real e-commerce application.

2) On the page using hidden form fields. This would be a better choice than a session variable, though still perhaps inadvisable in a real application.

3) In a database. The best solution, as your application maintains total control over the shopping cart. It also means a customer has the option to "save my cart, and I'll continue shopping later". It also seems a bit pointless to have a database and then not use it.

Does that help?
it helps, thank you

do you know where i can see a step by step tutorial/walkthrough whatever of the 3rd way you advise, i am still learning and i don't think i can handle that myself...
Um, yeah ...Google is your friend. Its second match wasBuilding an ASP.NET Shopping Cart Using DataTables. Now, these DataTables were stored in session objects. However, it would be extremely easy to change the DataTables to be stored in a database.

If you're serious about learning ASP.NET, run through theQuickStart Tutorials. At the end of those tutorials, there is a sample e-commerce storefront. Though this too stores the cart in a session variable ... so perhaps I was a bit harsh on this technique.

And if you're really serious about learning ASP.NET, ask your parents to buy youASP.NET Unleashed for Christmas. (And if you're not as young as I'm guessing, or you don't celebrate Christmas, please excuse my presumptions.)

This is the same path I took when learning ASP.NET.

I hope this helps you.
In my opinion, sessions are the best way to go when it comes to creating a real-world shopping cart system. you may want to consider using a datatable that you can store in a session. that's how i built mine. i don't really know if datatables are the best way to go, but i haven't had any problems with it.

As far as putting a cart system in a database, I wouldn't advise doing this unless you can figure out a way to let your customers add items to their cart without first having to login. (as would be the case with database-based carts).
i'm 19 and i'm a web development college student, i am looking for a good book, i'll probably buy that one, thanks for your assistance, i'll be asking soon, how to make the store site that i created to actually complete the transactions through paypal, it's kinda of a mess website with all those cookies etc. but i'm not getting paid for that project so i don't care that much haha ;) by the way where is the best place to ask questions connected to e-commerce and designing with visual studio?
Chapter 31 of ASP.NET Unleashed walks you through creating an online store and shopping cart. It uses a database for the cart, which is probably where I developed my bias.

If you find that you have messy code, discard it. Ultimately, it takes so much longer to bang on with messy code than to start again. If you want to build an e-commerce site, find a good example, and follow itfrom scratch.

Regarding where to post your questions, look at what the specific question is. If you're having trouble querying an SQL database about a stored customer order, then this is a database question, not an e-commerce question. Hence, you'd post it to the database forums.

If in doubt, post it to this Getting Started forum. The moderators will move it if it's truly in the wrong forum.

Good luck with ASP.NET!
I've built a few shopping cart apps for e-commerce and using datatables in session has always been my favorite for two reasons: ease of use and speed. It will also save you headaches dealing with concurrency. I also provide a link if they want to save their shopping cart that dumps it into a database for later retrieval.

On another note...you'll have a million different users telling you a million different ways to do the same thing. The easiest way to learn .net is not in a class but to grab your books, set up a few sample projects and work through all the issues, immersing yourself in the whole .net experience. Short of setting up an altar and burning votive candles to .net, it's a great environment and great for developing e-commerce solutions!

Good Luck!!

0 comments:

Post a Comment