Last Update:
Copyright ©: Circle Software


Shopping Cart Implementation Methods Discussed

There are two basic methods for implementing a shopping cart:
  1. Server-side scripts with client-side support
  2. Client-side scripts with server-side support

At first it might appear that there is little difference between the two. However, the difference lies in where the lion's share of the work is being done.

As I see it, the biggest disadvantage of #1 is that it is very server-side intensive, meaning every click sends something to the server and requires a response from the server. In the event that the web is slow this method will bog down and end up frustrating the client. I will say that this is not normally a problem from either people who use on-line shopping and have talked to me or from my own limited experience.

Either way requires extensive programming to support so there is no advantage for either method as far as that is concerned.

The biggest advantage to doing this Client-side is that the client is already dedicating their machine to this process and we can use those resources and have no time delay due to a slow server, or slow Internet, or slow connection. Then, once the client is finished they click submit, or print, and at that time they would normally expect a delay anyway, thus much less frustration.

Now, considering the client-side code. There are at least three ways of handling shopping cart data that I am aware of:
  1. Hidden fields which get passed between pages
  2. Cookies that hold the data, can be temporary or "permanent."
  3. Frames and data structures, can be hidden.

#1 (Hidden fields):
Advantage: simplicity of implementation
Disadvantages:
  1. The data gets passed on the URL line and is visible as the client builds   up her order.
  2. All pages whether they have anything to do with the shopping cart or not will need to be able to handle the URL data to keep passing it along until the client posts it. This could be very messy for any site that continually generates new pages since each and every page will need to be able to handle the data.

#2 (Cookies):
Advantages:
  1. Only pages that need the data need to be modified.
  2. Browser independent, as far as I know.
Disadvantages:
  1. More cumbersome to implement on an on-going basis.
  2. Need the same data structure for holding data to use as the Frame method   as well as special coding to handle putting the data into and taking out of the cookie. This increases development time since there's more to code.

#3 (Frames):
Advantages:
  1. Only pages that need the data need to be modified; there may be exceptions.
  2. Less coding to implement than cookies, about the same or less than server-side.
  3. If it turns out to be untenable almost all the code generated will be usable by the cookie method, so there will be little if any lost time to convert to the cookie method.
Disadvantages:
  1. The Exception noted above: If for any reason the site uses frames already or uses them sometimes but not all the time, and the shopping cart can be used from these "extra" frames, then a little extra coding will be needed to implement it between these extra frames and the hidden frame.
  2. May be browser dependent, no major indication of this so far as I know.

I have decided to experiment with the hidden frame method because it seems to me to be the best and I already have some experience doing it this way. Also, even if this method does not work out it will have prepared the way to use the cookie method and at least half the work, if not more, will already have been done.


Cart DEMO:  


Return to: previous page