Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2012
    Posts
    282
    Plugin Contributions
    0

    Default setting $_SESSION variables in an Observer Class

    i tried initializing a $_SESSION variable in an observer class like this...

    class hazMatProduct extends base {
    var $_SESSION['hm-agreement'] = false;

    but it throws an error. why does that create an error?,

    the error log doesn't pick it up and record.

    big thanks,

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

    Default Re: setting $_SESSION variables in an Observer Class

    You can't use $_SESSION in class variable declarations. That's just a PHP rule.
    You'll need to do that assignment in the constructor method instead.
    .

    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.

 

 

Similar Threads

  1. v153 Sharing PHP variables ($_SESSION question)
    By flyvholm in forum General Questions
    Replies: 5
    Last Post: 4 Nov 2014, 06:15 PM
  2. Passing variables without $_SESSION
    By fred_tededmondsson in forum General Questions
    Replies: 1
    Last Post: 31 Oct 2011, 07:25 PM
  3. Replies: 1
    Last Post: 21 Apr 2010, 06:37 PM
  4. where are $_SESSION variables set in order process
    By apathy in forum General Questions
    Replies: 0
    Last Post: 30 May 2008, 01:58 AM
  5. How come I can't modify $_POST variables in an observer
    By audleman in forum General Questions
    Replies: 6
    Last Post: 8 Apr 2008, 07:55 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