Skip to main content
Inspiring
July 5, 2006
Question

simple shop cart

  • July 5, 2006
  • 1 reply
  • 265 views
I need to create a small shopiing cart..Any leading will b appreciated..I have search page results...next to each item , there is a check box. The search page result has page navigation buttons. so whenever a check box is selected in each page, it should be added to the shooping cart by clicking add icon...Any suggestions..
    This topic has been closed for replies.

    1 reply

    July 6, 2006
    So you've got a catalog started, but have yet to build the cart.

    a cart is unique to each visitor, so you need to store the variables in the session, client, or cookie scope.

    a cart keeps track of items a visitor wishes to purchase, so you'll need item ID, number, name, price, options, etc.. stored in the cart.

    a cart also has room for multiple items, so you'll want to store the items in an array, structure or query object (all three of which rule out cookie as storage)

    so a cart has a few functions:
    add an item, remove an item, change the quantity of an item.

    if an item is added, you would obviously have to check if that same item was already in the cart or not. If it is not, add it to the container that holds the cart variables (your array or structure that is the cart in the session scope)
    if it does already exist, then update the quantity accordingly. So add and update are virtually the same function....

    If it is being removed, then remove the information regarding that item from the cart variable.

    after any of these function you can recount the totals, or you can leave that to only happen on the display page. the cart view page lists out all the items, prices, etc, and shows a total.

    shipping is up to you :) get the basics worked out and smooth, then add in some way to figure shipping costs.



    After any ad