( ! ) Warning: get_browser(): browscap ini directive not set in /var/www/vendorama/cart/includes/browser.inc on line 127
Call Stack
10.0002365192{main}( ).../index.php:0
20.0004365696include_once( '/var/www/vendorama/cart/includes/global.inc' ).../index.php:3
30.0009367976include_once( '/var/www/vendorama/cart/includes/browser.inc' ).../global.inc:82
40.0024381776get_browser ( ).../browser.inc:127
Docs: Session Variables on Vendo

Docs: Session Variables

Session variables can be used in any of your extension files. The easiest way to view is to print_r the SESSION array in your footer.php file:


or do a foreach loop:

foreach($_SESSION as $name => $value) {
       print ("$name: $value<br />";

You can also do this for cookies:

foreach($_COOKIE as $name => $value) {
       print ("$name: $value<br />";

Here are a few of the standard session variables:

$_SESSION['logged_in'] and $_USER['logged_out']
$_SESSION['order'] or $_USER[cart] ('empty' or 'full')

Example 1: check if user is logged in using the user_id session var

In this example we check if the visitor is logged in with the user_id session var and use the custom_text page variable to display text on the cart page:

if(isset($_SESSION['user_id']) and $_PAGE['page']=='order'){
      $_PAGE['custom_text'] = "<p>Welcome back ".$_SESSION['first_name'].".</p>";

The $_PAGE['custom_text'] variable can be inserted into the top.inc file and will be displayed immediately after the h1 tag.

Example 2: display a message using a snippet

Here is another example using session variables to create a snippet to insert into your template:

if(isset($_SESSION['first_name']) and isset($_SESSION['user_id'])){
      $snippet1 = "<p>Welcome back $_SESSION[first_name].</p>";
} else {
      $snippet1 = "<p>Welcome guest. <a href="/login/">Log in</a> or <a href="/account/new">create an account</a>.</p>";


Revisions history (52)    ( hide | show )     Variables > Session Variables