Code Library: Session Vars

put in custom PHP files (case-sensitive), and in template header.html and footer.html (case-insensitive) eg {$_SESSION['first_name']}

Session Vars  Description Result
Users user agent (browser) Default Browser
Users user agent (browser version)
User’s country ID (numeric) 2
Custom order id set in preferences
Sets whether to show empty categories in category links menu
Default for ordering of products on category and search pages
Sets whether to display sortby as links or HTML select menu selection
Sets the maximum characters displayed on category pages for subcategories&rsquo descriptions. If set to below 999 the HTML tags will be stripped. To display all set 999 or above.
Sets limit to character count of summary on category and search pages 300
Display variants as HTML radio or select 1
User firstname
Google sitemaps meta code (homepage)
Language, eg en, set in preferences en
Timestamp for user last visit
User’s cart contents
Reseller or partner ID number 2
User operating system
Sets whether to display tax in totals
URI for the shop section, set in preferences, default shop shop/vendo
Show add to cart on category and product pages 3
Sets whether an image placeholder is displayed where a product has no image
Site URL www.vendo.co.nz
Seets whether to display sortby menu search_category
Short URLs, (1 = long, words, 2 = short, numeric)
Current master template 5
Google analytics code
User email
Customers user ID number (in customers) numeric
Store country id (numeric) set in preferences 121
Store currency (array) set in preferences array ( 'id' => '44', 'unit' => 'NZD', 'symbol' => '$', 'rate' => '0.5885150118', 'name' => 'New Zealand Dollars', 'format' => 1, )
Site locale set in preferences en_NZ
Site name set in profile Vendo
Tax type for vendor country
Pacific/Auckland
Units for shipping weight and length (array) array ( 'weight' => array ( 'name' => 'Kilogram', 'unit' => 'Kg', 'symbol' => '', 'rate' => '1.0000', ), 'length' => array ( 'name' => 'Centermetre', 'unit' => 'cm', 'symbol' => '', 'rate' => '1.0000', ), 'volume' => NULL, 'volumetric' => '0', )
User’s visit ID (numeric) for stats

Session Variables in your PHP files

PHP Session variables are generated by Vendo, but you can also create your own.

Most Session variables are strings, however some may be arrays, such as $_SESSION['order'] which contains the elements the user has added to their cart.

To view all session variables when testing add the following to your top.inc file:

<?
print "<pre>";
print_r($_SESSION);
print "</pre>";
?>

Or:

<?
print "<pre>";
foreach($_SESSION as $key => $value) {
     print "[".$key."] => ";
     if(is_array($value)) print_r($value);
     else print $value."\n";
}
print "</pre>";
?>
×