Results 1 to 5 of 5
  1. #1
    Join Date
    Oct 2007
    Posts
    18
    Plugin Contributions
    0

    Default Customer session variable

    Hi
    I'm fairly new to Zen and have inherited a system that needs to be changed.
    Can I get access to the customer id from (say) the session variables on the shopping cart page ?
    I need to amend the contents of the cart depending on the customer and the products in the cart.
    Thanks
    4ec

  2. #2
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Customer session variable

    You could just use:
    $_SESSION['customer_id']

    which is set when the customer logs in ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.5]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  3. #3
    Join Date
    Oct 2007
    Posts
    18
    Plugin Contributions
    0

    Default Re: Customer session variable

    Hi
    yes, thanks for that. I've tried writing a test page to display this once I've logged on but it seems to be blank.
    Is there a collection of session variables that I could maybe loop through to see if I'm getting any at all ?
    Or do I need to include some other piece of logic to grab the session variables before trying to display them ?
    Thanks again.
    4ec

  4. #4
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Customer session variable

    If you were to add this to your file: tpl_header.php

    PHP Code:
    echo 'I SEE ' $_SESSION['customer_id']; 
    in the /common directory you would see nothing when not logged in and the customers_id when you are logged in ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.5]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  5. #5
    Join Date
    Oct 2007
    Posts
    18
    Plugin Contributions
    0

    Default Re: Customer session variable

    Great - many thanks.
    It took me a while to figure out that I was using the wrong tpl_header file - but I'm onto it now.
    Many thanks.

    4ec

 

 

Similar Threads

  1. v154 Naming a global variable the same as a SESSION, GET or POST variable
    By torvista in forum General Questions
    Replies: 5
    Last Post: 6 Dec 2015, 11:11 AM
  2. how to add a new session variable?
    By delia in forum General Questions
    Replies: 11
    Last Post: 13 Oct 2011, 02:51 PM
  3. Possible IE9/session variable issue?
    By pfabrick in forum General Questions
    Replies: 1
    Last Post: 11 May 2011, 10:00 PM
  4. Location/Initialize Session Variable
    By DLLong in forum General Questions
    Replies: 1
    Last Post: 9 Aug 2008, 01:11 AM
  5. How do i add a new session variable?
    By rosebabu in forum General Questions
    Replies: 0
    Last Post: 7 May 2008, 03:03 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR