Results 1 to 7 of 7
  1. #1
    Join Date
    Jul 2005
    Location
    Orlando, Fl
    Posts
    324
    Plugin Contributions
    0

    help question Get $_SESSION['cart'] data on a non-zen page

    I have a page on my site running another open source script that i want to access the Zen cart session from.

    This page is not a zen cart page.

    Is there a way to do this so I can display cart counts on this other page.

    Thanks in advance

    ~D

  2. #2
    Join Date
    Aug 2005
    Location
    Arizona
    Posts
    27,761
    Plugin Contributions
    9

    Default Re: Get $_SESSION['cart'] data on a non-zen page

    Due to sessions security this is almost impossible
    Zen-Venom Get Bitten

  3. #3
    Join Date
    Jul 2005
    Location
    Orlando, Fl
    Posts
    324
    Plugin Contributions
    0

    Default Re: Get $_SESSION['cart'] data on a non-zen page

    Thanks for the quick reply on this.

    All i need is the cart count from this here.

    PHP Code:
    $_SESSION['cart']->count_contents() 
    Is there a way to save this data in a separate cookie or session outside of the Zencart DB Session.

    Everything I have tried stores it in the DB.

    Thanks Again

  4. #4
    Join Date
    Aug 2005
    Location
    Arizona
    Posts
    27,761
    Plugin Contributions
    9

    Default Re: Get $_SESSION['cart'] data on a non-zen page

    Everything I have tried stores it in the DB
    Check your configure.php files for
    define('STORE_SESSIONS', 'db');
    Change to "none" or "file" see if this helps

    none = ''
    Zen-Venom Get Bitten

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

    Default Re: Get $_SESSION['cart'] data on a non-zen page

    Yes, you could add your own custom code to Zen Cart to have it set another cookie with the information you seek. As long as the cookie's domain name matches the domain shared by both software systems.
    .

    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.

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

    Default Re: Get $_SESSION['cart'] data on a non-zen page

    Quote Originally Posted by kobra View Post
    Check your configure.php files for

    Change to "none" or "file" see if this helps

    none = ''
    No. Don't mess with STORE_SESSIONS. That won't help the OP with the matter they're seeking. It will only cause other problems.
    .

    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.

  7. #7
    Join Date
    Jul 2005
    Location
    Orlando, Fl
    Posts
    324
    Plugin Contributions
    0

    Idea or Suggestion Re: Get $_SESSION['cart'] data on a non-zen page

    Thanks Dr B.,

    I got it working.

    Question though, Should I be using something different for the expire time?

    I used the following code to set the cookie.

    PHP Code:
    setcookie('zenGCT',$_SESSION['cart']->count_contents(),'0','/','www.mydomain.com'); 
    Now on my non-zen pages I can call the value.

    PHP Code:
    echo $_COOKIE['zenGCT']; 
    I then though it would be a good idea to mask the actual count so I added some math.

    PHP Code:
    setcookie('zenGCT',$_SESSION['cart']->count_contents() * 999,'0','/','www.mydomain.com'); 
    and

    PHP Code:
    echo $_COOKIE['zenGCT'] / 999
    You could set the 999 to whatever you wanted.

 

 

Similar Threads

  1. Using $_SESSION outside Zen-Cart?
    By seanbig in forum General Questions
    Replies: 3
    Last Post: 21 Dec 2010, 08:21 AM
  2. Replies: 16
    Last Post: 22 Jun 2010, 01:33 PM
  3. Access the $_SESSION from a non-zen folder
    By drbyday in forum General Questions
    Replies: 4
    Last Post: 19 Sep 2009, 04:39 AM
  4. Replies: 0
    Last Post: 20 Aug 2009, 09:04 PM
  5. Access the $_SESSION from a non-zen script
    By FrankDeRosa in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 12 Jun 2009, 08:11 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