views:

167

answers:

2

We are looking for approach to implement shopping-cart that keep shopping items at the bottom of the page, just like CrateAndBarrels

http://www.crateandbarrel.com/family.aspx?c=837&f=28291

The visitor should be able to add shopping item to the cart by clicking the item's "+ Add to Cart" button. From my understanding, for CrateAndBarrel the bottom shopping-cart is indeed a flash object. However, I wish we could find a way to implement this in ajax-fashion if possible.

We are not expert in anyway in web 2.0 stuff and looking for some guide to implement this feature. Our consultant suggest we use frame to implement this though.

  1. If you were me how would you implement this feature ?

    • A. Plain WebForms page
    • B. Use Frame or IFrame.
    • C. HTML and Flash, just like CrateAndBarrel
    • D. AJAX
  2. Some simple explanation on how those components should collaborate will be appreciated.

Thanks.

+2  A: 

I would definately go with AJAX. Look at jquery or one of the other frameworks to help you do most of the work.

I would create a method to draw the bottom panel. This would then be called when the page loads, with an asynchronous call to get the cart contents. When the user adds an item to the cart, you could either refresh the page (which would re-draw the panel) or call an update method to redraw the cart contents.

Adam Pope
I too prefer AJAX. However, I'm definitely not an ajax veteran, and cannot provide strong argument against my consultant advice.What do you think about the frame solution ? Is it reasonable to use frame in this situation ?
Sake
You don't need to use a frame, and frames are generally bad. The question is why should you use an frame, not why shouldn't you.
DanSingerman
May I asy why "frames are generally bad" ?
Sake
In the context of Ajax I would say it is because you then have two DOMs to manage, rather than a single one. That strikes me as an unnecessary complication. From an SEO point of view, to have a frame (not an iframe) you will need to have the 'main' page inside a frameset too - which is very bad.. You could have an iframe, but that doesn't really buy you anything over a DIV, and will have the same problems with absolute positioning, etc.
DanSingerman
Some more on the badness of frames here: http://www.reubenyau.com/top-10-reasons-why-website-frames-are-bad/
DanSingerman
As HermanD has alluded, frames will kill your sites SEO. An unobtrusive floating AJAX panel will do you no harm. Make sure you offer an static page to view the cart as well, else users without JavaScript (if there are any anymore?) will be stuck.
Adam Pope
+1  A: 

1) Personally I would use Ajax (and I am pretty sure CrateandBarrel must be doing that, and using Flash just to render the basket) - weirdly although my Firefox is up to date it won't let me use their site in that)

You can then render the basket with an absolutely-positioned DIV at the bottom of the viewport.

You could use a frame, but I think an absolutely positioned DIV would be a better solution.

(2) As Adam Pope says, when an item is added (via Ajax) the basket can be redrawn (maybe a JSON call to get the basket contents?).

And definitely use a javascript framework.

Edit: And remember to let it degrade gracefully for anyone who does not have javascript!

DanSingerman
I'd better leave "degrade gracefully" for later time. My boss want it ASAP. Anybody without javascript can try phone-order. ;)
Sake
Finally, I can convince the team to use javascript, we are going to use script.aculo.us. Thanks for the answer.
Sake