Persistent cart?

3 views
Skip to first unread message

wgw

unread,
Jun 29, 2009, 9:27:57 PM6/29/09
to Satchmo users
On logout, the shopping cart is cleared. Any suggestions about how
attach a cart to a user account so that if a customer logs back in
again the cart and selected products are waiting for him/her?

Thanks for any suggestions!

Bob Waycott

unread,
Jun 30, 2009, 9:06:37 AM6/30/09
to satchm...@googlegroups.com
Every Cart object has a Cart.customer field, which is a pointer to a Contact object. You could write your own method for creating a new cart from the previous Cart object upon login given the Contact object that is created for that session once the user is logged in (every User object is tied to a Contact object).

wgw

unread,
Jun 30, 2009, 9:26:28 AM6/30/09
to Satchmo users
Thanks for pointing me in the right direction. I suppose I will have
to make a separate persistent cart, because there is no policy (AFAIK)
about when carts are garbage collected.

Bob Waycott

unread,
Jun 30, 2009, 10:03:56 AM6/30/09
to satchm...@googlegroups.com
Before you start on it, have a good look through the Cart code & see exactly what's going on & when. That will help you immensely.

Bruce Kroeze

unread,
Jun 30, 2009, 12:41:16 PM6/30/09
to satchm...@googlegroups.com
On Tue, Jun 30, 2009 at 7:03 AM, Bob Waycott<bobwa...@gmail.com> wrote:
> Before you start on it, have a good look through the Cart code & see exactly
> what's going on & when. That will help you immensely.

Also take a look at the wishlist app. There's custom code to load a
cart from a wishlist. You could do something similar.

>
> On Tue, Jun 30, 2009 at 9:26 AM, wgw <wgwi...@gmail.com> wrote:
>>
>> Thanks for pointing me in the right direction. I suppose I will have
>> to make a separate persistent cart, because there is no policy (AFAIK)
>> about when carts are garbage collected.
>>
>> On Jun 30, 6:06 am, Bob Waycott <bobwayc...@gmail.com> wrote:
>> > Every Cart object has a Cart.customer field, which is a pointer to a
>> > Contact
>> > object. You could write your own method for creating a new cart from the
>> > previous Cart
>> > object upon login given the Contact object that is created for that
>> > session once the user is logged in (every User object is tied to a
>> > Contact object).
>> >
>>
>
>
> >
>



--
Bruce Kroeze
http://solidsitesolutions.com
Dynamic Designs, Optimized

wgw

unread,
Jun 30, 2009, 1:57:01 PM6/30/09
to Satchmo users
Thanks for the suggestions.

I'm thinking now that if I can attach a cart object to every login id
(and use listeners to keep it synchronized with the default cart),
then that would do it. At present, I think the cart is linked to the
contact object (and when there is no contact information for a user,
there is no customer information set in the admin page at
home>shop>shopping cart), even though the contact object may not
exist. A persistent cart has to be attached to something that cannot
NOT be. Of course, that would seem to suggest that all users would
have to set up a user account and login before browsing the site,
which in my application is not a problem. (Another way: when they are
about to leave the site, warn new users that their cart will be lost
if they don't create an account before leaving....)


On Jun 30, 9:41 am, Bruce Kroeze <bkro...@gmail.com> wrote:
Reply all
Reply to author
Forward
0 new messages