best way to code a basket

Posted on 2011-10-23
Last Modified: 2012-05-12

I'm just about to start developing my first e-commerce basket and will be using .net 4.

I'm wondering if there is a "standard" way of doing it these days?

Do I use cookies, sessions or something else?

Presumably upon adding an item to the basket it just gets stored with a "basket or session id" and then it is the basket or session id that is available on all pages to pull up the basket?

I'm just looking for a basic overview of the best way to do things to ensure the session can't be lost and where I am not going to come up against issues with cookies disabled etc.

Would appreciate your thoughs and guidance...
Question by:scm0sml
    LVL 16

    Expert Comment

    A sessionID (that uses cookies) could be used to track the user and you can store the cart items in the database.

    You can take a look at this free open source shopping cart that uses .net 4 :

    It's a pretty good system that I am currently using for web stores.

    LVL 16

    Expert Comment

    If you want something a little less complex and in Visual Basic,
    you could take a look at this book that has good shopping cart code :

    You can buy it used for $0.08.
    I actually used this book to build an ecommerce website that did very well
    and was making about $500,000.00 a year.
    LVL 10

    Expert Comment

    Basically a shopping cart can be reduced to several pages all using Session Varaibles, response.redirect("review.aspx"):

    Product Page
    >>lists details of product and allows users to choose to put in shopping cart
    Shopping Cart
    >>Shows all products desired to be purchased, allows the user to manage list
    Purchase Page
    >>usuallty a purchase page that sums up the total dollar amount(thats all the merchat cares about), onClick redirects them to purchase page
        will they enter credit card info.  You would find fields such as email addres, name, dropdownlist  of states, credit card number(you can only use last 4 digits on web form)
    Review Page
    >> after the user enters details, they can confrim and submit order to merchat processor
    On Complete Order page
    >>most use an API like, if there are errors, return an error code, other wise reward teh user with a confirmation order page and manage their accounts, ie get free point on database

    Accepted Solution

    Thanks guys.

    I think one of the biggest things I wanted was to make sure there was no chance of the basket being dropped because of a timed out session etc.

    I have gone with the idea of storing a basket guid in a cookie and then just  pulling the basket data from the database using that.

    Anyone have any issues with that way?

    Author Closing Comment

    used my own answer...

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
    The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (…
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    24 Experts available now in Live!

    Get 1:1 Help Now