Page 1 of 2 12 LastLast
Results 1 to 10 of 12
  1. #1
    Join Date
    May 2006
    Location
    Gardiner, Maine
    Posts
    2,296
    Plugin Contributions
    22

    Default how to add a new session variable?

    Drawing a blank here and I don't know if this is a zen cart question or a php question or both.

    I want to add a session variable for both guest and logged in user. How/where would I do that?
    The full-time Zen Cart Guru. WizTech4ZC.com

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

    Default Re: how to add a new session variable

    What do you want to do with the session variable?

    A hint would make this easier ...
    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
    May 2006
    Location
    Gardiner, Maine
    Posts
    2,296
    Plugin Contributions
    22

    Default Re: how to add a new session variable?

    Ah, sorry. (I seem to be always apologizing on the forum when I post questions!)

    I'm looking to set up the columns vs rows scenario for the product listing as a changeable thing for anyone. They will be able to change the listing display at will simply by clicking a button.

    So I would need the session variable to be present immediately on site entry, I assume.
    The full-time Zen Cart Guru. WizTech4ZC.com

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

    Default Re: how to add a new session variable?

    You could probably add it to the bottom of the:
    /includes/init_includes/init_session.php

    with something like:
    Code:
    // bof: set $_SESSION['my_session_variable'] if not previously set
    if (!isset($_SESSION['my_session_variable'])) {
      $_SESSION['my_session_variable'] = 'something';
    }
    // eof: set $_SESSION['my_session_variable'] if not previously set
    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
    May 2006
    Location
    Gardiner, Maine
    Posts
    2,296
    Plugin Contributions
    22

    Default Re: how to add a new session variable?

    Thanks, Linda!
    The full-time Zen Cart Guru. WizTech4ZC.com

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

    Default Re: how to add a new session variable?

    Sure thing ... thanks for the update that this can work for you ...
    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!

  7. #7
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: how to add a new session variable?

    In the interest of preventing clashes with core files, I'd suggest putting it in its own file, in two steps, like this:

    a) /includes/auto_loaders/config.your_mod_name.php
    Code:
    <?php
      $autoLoadConfig[115][] = array('autoType'=>'init_script',
                                     'loadFile'=> 'init_my_custom_init_code_here.php');
    b) /includes/init_includes/init_my_custom_init_code_here.php
    Code:
    whatever session code or other stuff you need to run
    .

    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.

  8. #8
    Join Date
    May 2006
    Location
    Gardiner, Maine
    Posts
    2,296
    Plugin Contributions
    22

    Default Re: how to add a new session variable?

    Oh, good, I need that!
    The full-time Zen Cart Guru. WizTech4ZC.com

  9. #9
    Join Date
    May 2006
    Location
    Gardiner, Maine
    Posts
    2,296
    Plugin Contributions
    22

    Default Re: how to add a new session variable?

    I can't tell you how powerful that makes me feel! It worked!
    The full-time Zen Cart Guru. WizTech4ZC.com

  10. #10
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: how to add a new session variable?

    .

    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.

 

 
Page 1 of 2 12 LastLast

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. v150 Can I add another variable to the session?
    By tifischer in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 17 Jul 2013, 08:29 PM
  3. v150 how can i add session variable with it file path ?
    By tony_sar in forum General Questions
    Replies: 3
    Last Post: 14 Feb 2012, 01:50 PM
  4. Add a new session variable and save to order?
    By Cindy2010 in forum All Other Contributions/Addons
    Replies: 3
    Last Post: 19 Jan 2011, 09:54 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