• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Retain the abandoned cart details when the user logs in again

 
Ranch Hand
Posts: 255
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I am working on a shopping cart application, in which if the user abandoned the cart after adding items to the cart (without going thru the checkout process) , in such case how we can retain those abandoned cart details and propose to that user when he logs in for the next time to the shopping site. How we can build the logic in J2EE for the same? Please clarify.

Thanks,
Rithanya
 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Without more information regarding your overall design this question is difficult to answer. However, Oracle has a very good example of a shopping cart application that you might find helpful.

https://docs.oracle.com/cd/E13210_01/wlcs/docs31/order/shopcart.htm
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That example is for Oracle Weblogic Commerce Server.
Try the working with cookies trail in the Java tutorial:

A cookie is a piece of data that can be stored in a browser's cache. If you visit a web site and then revisit it, the cookie data can be used to identify you as a return visitor. Cookies enable state information, such as an online shopping cart, to be remembered. A cookie can be short term, holding data for a single web session, that is, until you close the browser, or a cookie can be longer term, holding data for a week or a year.

 
Rithanya Laxmi
Ranch Hand
Posts: 255
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Trager, this is nothing to do with the design, how we can retain the shopping cart details which is abandoned by the user before completing the checkout process. So when the user logins again we can get the shooping cart details which he has abondoned? Please clarify how we can do it in Java/J2EE?
 
Joe Ess
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Rithanya Laxmi wrote:So when the user logins again we can get the shooping cart details which he has abondoned?



If your user is logging in, you should be creating a database record of his encounter and retrieving it on his next visit. That way you don't have to worry about him clearing his cookies or someone else using his computer and seeing his order in progress.
 
Rancher
Posts: 4801
50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Rithanya Laxmi wrote:Trager, this is nothing to do with the design, how we can retain the shopping cart details which is abandoned by the user before completing the checkout process. So when the user logins again we can get the shooping cart details which he has abondoned? Please clarify how we can do it in Java/J2EE?



Of course it's to do with design.
A proper solution can be affected by what design decisions you've come up with for your app so far.

As Joe says, though, if there's a login involved then you're probably looking at storing it in a database.
 
Rithanya Laxmi
Ranch Hand
Posts: 255
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Guys, but my question is I have the user info stored in the DB, but still how I will come to know what are the items the user has added to the cart before abandoning the transaction? So that when the user login again he can have the same items populated in the cart and he can start the shopping from where he left off? Whether the shopping items added to the cart needs to be stored in the DB as well for that user? Please clarify. How we can go about it?
 
Dave Tolls
Rancher
Posts: 4801
50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, yes.
The users cart will need to be persisted.

How is the cart currently being maintained between requests?
 
Rithanya Laxmi
Ranch Hand
Posts: 255
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Currently the cart items are not persisted in the DB in such case how we can get the cart items if the transaction is abandoned before the completion?
 
Dave Tolls
Rancher
Posts: 4801
50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, how is it being maintained between requests, though?
Where is the cart between me adding an apple into it and me adding a Ferrari?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic