You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ofbiz.apache.org by jaki <ja...@infosys.com> on 2008/06/01 10:23:16 UTC

Re: Users - Re: Shopping Cart Persistence?

With a view to implement the above requirement, I decided to use the session
object to store the cart existing prior to login. Then once the user logs
in, I would add the items in this session object to the items in the users
own cart which is retrieved after logging in ( i have 'auto-save' enabled). 
I did this by adding the current cart into the session object with a
different name in getCartObject() since that method is the most likely of
the cart methods to be called during a session. But I also made sure this is
done only if the user is not logged in by enclosing it in an 'if' condn. But
in spite of this, the guest cart gets over written with the user's cart
everytime he logs in. Can anyone explain why this should happen? I even
moved my code into addtoCart() but to no avail. 
Even if a new session is created when the user logs in, this custom cart
should either remain the same or become null since it should get created
only when the user is not logged in



David E Jones wrote:
> 
> 
> I haven't had a chance to look at this, but it sounds like some code  
> changes are needed to fix these issues (which may have existed from  
> when this was implemented the first time, or may have been introduced  
> later as other things this uses have shifted around).
> 
> -David
> 
> 
> On May 30, 2008, at 7:47 AM, jaki wrote:
> 
>>
>> Thanks that seems to have done the trick. But in some cases the cart  
>> doesn't
>> get emptied on logout and remains static (has the same contents)  
>> even if you
>> login again with a different user.
>>
>> Also, when you login, the contents added before logging in (or as a  
>> guest
>> user) gets totally wiped out and is replaced by the cart for the  
>> user (ie
>> the cart with contents the user had added on his previous logged in
>> session). Anyway to fix this? i.e. the cart contents from prior to  
>> logging
>> in should be clubbed with the contents loaded after logging in
>>
>>
>>
>> David E Jones wrote:
>>>
>>>
>>> The field that turns this on and off for a store is
>>> ProductStore.autoSaveCart.
>>>
>>> -David
>>>
>>>
>>> On May 30, 2008, at 12:43 AM, jaki wrote:
>>>
>>>>
>>>> Sorry to be resurrecting this ancient thread, but which is this flag
>>>> mentioned in the quoted post? Kindly help me here as my ofbiz seems
>>>> unable
>>>> to persist a shopping cart beyond the current session
>>>>
>>>>
>>>> Andrew Zeneski wrote:
>>>>>
>>>>> There is code in place currently which will persist the shopping  
>>>>> cart
>>>>> into a shopping list each time it modified. There is a flag I  
>>>>> believe
>>>>> on the product store which enables/disables this behavior. The cart
>>>>> is reloaded each time the user returns based on what is currently  
>>>>> in
>>>>> that special purpose shopping list.
>>>>>
>>>>> Andy
>>>>>
>>>>> On Dec 7, 2005, at 8:39 AM, <ji...@bt.com>
>>>>> <ji...@bt.com> wrote:
>>>>>
>>>>>> Hi All,
>>>>>>
>>>>>> Can the shopping cart be made persistent for an anonymous journey
>>>>>> by some configurable parameter. Currently OOTB, the shopping cart
>>>>>> is a session based object so I would lose my shopping cart once I
>>>>>> lose the session.
>>>>>>
>>>>>> regards,
>>>>>>
>>>>>> Jitender
>>>>>>
>>>>>> _______________________________________________
>>>>>> Users mailing list
>>>>>> Users@lists.ofbiz.org
>>>>>> http://lists.ofbiz.org/mailman/listinfo/users
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> Users mailing list
>>>>> Users@lists.ofbiz.org
>>>>> http://lists.ofbiz.org/mailman/listinfo/users
>>>>>
>>>>>
>>>>
>>>> -- 
>>>> View this message in context:
>>>> http://www.nabble.com/Users---Re%3A-Shopping-Cart-Persistence--tp1832282p17552652.html
>>>> Sent from the OFBiz - User mailing list archive at Nabble.com.
>>>>
>>>
>>>
>>>
>>
>> -- 
>> View this message in context:
>> http://www.nabble.com/Users---Re%3A-Shopping-Cart-Persistence--tp1832282p17559290.html
>> Sent from the OFBiz - User mailing list archive at Nabble.com.
>>
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Users---Re%3A-Shopping-Cart-Persistence--tp1832282p17583370.html
Sent from the OFBiz - User mailing list archive at Nabble.com.