Forums / General Questions / Current Customer / Sessions

Current Customer / Sessions

Results 1 to 4 of 4
07 Feb 2011, 23:07
#1
jm_ink avatar

jm_ink

New Zenner

Join Date:
Feb 2011
Posts:
4
Plugin Contributions:
0

Current Customer / Sessions

I'm having trouble finding information about customer sessions. If I wanted to code a page where the user could click a button and get an e-mail listing how many products they have bought (or any arbitrary information from their personal account/database table) would I locate the current user by looking into the session information? If not, how might I be able to access the current customer to do mySQL look-ups on their account information?
07 Feb 2011, 23:36
#2
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Posts:
62,757
Plugin Contributions:
1

Re: Current Customer / Sessions

The customers_id is references as:
$_SESSION['customer_id']

when the customer is logged in ...
08 Feb 2011, 04:32
#3
jm_ink avatar

jm_ink

New Zenner

Join Date:
Feb 2011
Posts:
4
Plugin Contributions:
0

Re: Current Customer / Sessions

So just to be clear- also I apologize if this sounds stupid, as I'm not very familiar with web dev- you can access the customer id from that reference from any php file in the server's zen cart folder. i.e. i could just type

echo $_SESSION['customer_id']

as the body for a page linked to the sidebar and it would print the customer's id? (although printing info is not necessarily my goal)
08 Feb 2011, 14:00
#4
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Posts:
62,757
Plugin Contributions:
1

Re: Current Customer / Sessions

Yes, the current logged in customer can be checked with the:
$_SESSION['customer_id']

and when 0, then the customer is not logged in ...