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
Printable View
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
Due to sessions security this is almost impossible
Thanks for the quick reply on this.
All i need is the cart count from this here.
Is there a way to save this data in a separate cookie or session outside of the Zencart DB Session.PHP Code:
$_SESSION['cart']->count_contents()
Everything I have tried stores it in the DB.
Thanks Again
Check your configure.php files forQuote:
Everything I have tried stores it in the DB
Change to "none" or "file" see if this helpsQuote:
define('STORE_SESSIONS', 'db');
none = ''
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.
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.
Now on my non-zen pages I can call the value.PHP Code:
setcookie('zenGCT',$_SESSION['cart']->count_contents(),'0','/','www.mydomain.com');
I then though it would be a good idea to mask the actual count so I added some math.PHP Code:
echo $_COOKIE['zenGCT'];
andPHP Code:
setcookie('zenGCT',$_SESSION['cart']->count_contents() * 999,'0','/','www.mydomain.com');
You could set the 999 to whatever you wanted.PHP Code:
echo $_COOKIE['zenGCT'] / 999;