|
|
 |
Re: FN-FORUM: Advice on building a shopping basket
date posted 11th May 2006 21:41
Slightly different approach here:
Registered users log on and have a basket in the database.
Unregistered users use a session array as a basket.
If a user adds items to the basket, then registers or logs on, the items
are copied to the database. This means that registered users can keep
the contents of their cart, whilst unregistered ones lose them once the
browser closes.
It also means that no-one is forced to register in order to buy.
Lee.
Andy Macnaughton-Jones wrote:
> This is what we do;
>
> Basket table with user_id and guid_id. Guid ID is generated per session.
>
> (1) new user adds stuff to shopping basket. On addition of first new
> item, system creates a new basket and assigns to users GUID (randomly
> generated id)
>
> (2) user then goes to check out, system requests them register which
> creates a userid
>
> (3) system then assigns user_id to the newly created basket and the
> user_id is then used throughout.
>
>
> (4) User comes back again for another shopping trip...
>
> (5) again, new basket gets created that has a new guid
>
> (6) user then logs on, system knows that there was a previous basket so
> puts all the new stuff into the old basket and assigns that.
>
> So essentially an unknown user has a temporary basket, a known user has
> their own personal basket and any new stuff gets put into that once the
> system knows who they are.
>
> Cheers
> Andy
>
>
>
>
> -----Original Message-----
> From: [EMAIL REMOVED] [EMAIL REMOVED] On Behalf Of Andy
> Macnaughton-Jones
> Sent: 11 May 2006 19:00
> To: Andy Macnaughton-Jones
> Subject: RE: FN-FORUM: Advice on building a shopping basket
>
>
> We do this for our e-commerce - will drop you a line later if you still
> need to know.
>
> -----Original Message-----
> From: [EMAIL REMOVED] [EMAIL REMOVED] On Behalf Of D D
> Glendinning
> Sent: Thursday, May 11, 2006 9:25 AM
> To: Andy Macnaughton-Jones
> Subject: FN-FORUM: Advice on building a shopping basket
>
>
> Good Morning All,
>
> Right, I have been building this shopping basket for an online shop. I
> had designed it so that the visitor needs to register and log in before
> they may add items to the basket. When they are added, it checks for an
> "Open" basket, and if there is one, adds the item to it (Order_Item
> table), or else it creates a new empty shopping basket, tagged with the
> user's ID.
> This works really well, and has the added advantage that if they add
> items to the basket, and then log out, the items are there for them to
> continue with when they log back in.
>
> The issue I now have is allowing non registered visitors to add items,
> and then register at the checkout stage, rather than before. I have a
> few ideas, such as creating a random session ID key, and using that
> instead of the userID, and when they register, changing the random
> session ID to the newly created UserID... But not sure.
>
> No point in re-inventing the wheel if there is a standard practice for
> this, so look forward to hearing from you with your thoughts!
>
> Many Thanks,
>
> Duncan
>
> --
> Duncan Glendinning
> M: 07944797010
> W: www.spider-consultancy.co.uk
>
> --
> Freelancers, contractors earn more with Prosperity4 Call 0870 870 4414
> or visit www.prosperity4.com and benefit from Inland Revenue approved
> expenses today.
>
> To advertise here: http://www.freelancers.net/advertising.html
>
>
> --
> Freelancers, contractors earn more with Prosperity4 Call 0870 870 4414
> or visit www.prosperity4.com and benefit from Inland Revenue approved
> expenses today.
>
> To advertise here: http://www.freelancers.net/advertising.html
>
>
>
|
 |
|