Forums / General Questions / Logoff Without Emptying Cart

Logoff Without Emptying Cart

Locked

Views: 1,166

Results 1 to 4 of 4
This thread is locked. New replies are disabled.
3 Mar 2007, 8:17 PM
#1
kgzotu avatar

kgzotu

Zen Follower

Join Date:
Mar 2006
Posts:
125
Plugin Contributions:
0

Logoff Without Emptying Cart

I'm working on a modification where it would be advantageous to be able to log the user off without emptying their cart. I'm afraid I don't understand the dynamics at work too well, so I have a question.

I've found that I can do this by nullifying their customer_id. Is this Kosher? Or will Bad Things Happen?

Thanks for the help,
Joe

Now J_Schilz
Integrated Checkout Without Account
(wiki w/pics, demo, download)

4 Mar 2007, 4:54 AM
#2
Kim avatar

Kim

Obaa-san

Join Date:
Jun 2003
Location:
West Coast, North America
Posts:
26,681
Plugin Contributions:
0

Re: Logoff Without Emptying Cart

Joe-

If the user is logged in to start with, their cart is saved. If the customer is a guest then the cart is not saved when the session expires.

Please do not PM for support issues: a private solution doesn't benefit the community.

Be careful with unsolicited advice via email or PM - Make sure the person you are talking to is a reliable source.

4 Mar 2007, 5:02 AM
#3
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Logoff Without Emptying Cart

KGZotU:

I'm working on a modification where it would be advantageous to be able to log the user off without emptying their cart. I'm afraid I don't understand the dynamics at work too well, so I have a question.

I've found that I can do this by nullifying their customer_id. Is this Kosher? Or will Bad Things Happen?

Kim:

If the user is logged in to start with, their cart is saved. If the customer is a guest then the cart is not saved when the session expires.

To clarify ...

  1. the logged-in user has the customer_id set. When the session expires, it is blanked.
  2. the non-logged-in user never has it set.
  3. sessions expire after 24 minutes of inactivity
  4. whilst shopping, the cart is saved/updated every time they click to make adjustments
  5. if you blank the customer_id, you effectively log the customer out.
    Or you could just kill the session by calling zen_session_destroy(); (this is the most efficient way)

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

4 Mar 2007, 5:48 AM
#4
kgzotu avatar

kgzotu

Zen Follower

Join Date:
Mar 2006
Posts:
125
Plugin Contributions:
0

Re: Logoff Without Emptying Cart

Kim and DrByte,

Thank you for the responses. It sounds like I'm not going to corrupt the system by blanking the customer ID.

Kim, I should have provided a little more info. (; I'm trying to further the appearance that there is no account creation going on for my checkout without account mod. In this case, if a user has begun checking out without an account and then tries to enter a GV--through gv_redeem, the option to enter it during checkout is removed--then I want to give them an opportunity to create an account without having to execute a more conventional logoff and lose their cart contents.

Nulling the customer ID and redirecting them to login, with message, seems to be doing the trick.

Again, thank you both for your help.

--Joe

Now J_Schilz
Integrated Checkout Without Account
(wiki w/pics, demo, download)