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 PFD
Sets whether to show empty categories in category links menu
Default for ordering of products on category and search pages 4
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. 999
Sets limit to character count of summary on category and search pages 5000
Display variants as HTML radio or select 2
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
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.petfooddirect.co.nz
Seets whether to display sortby menu search_category
Short URLs, (1 = long, words, 2 = short, numeric)
Current master template 2
Google analytics code UA-3396764-10
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.5974311655', 'name' => 'New Zealand Dollars', )
Site locale set in preferences en_NZ
Site name set in profile PetFood Direct
Tax type for vendor country array ( 'name' => 'GST', 'rate' => '15.00', 'country_name' => 'New Zealand', )
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>";
?>
 
×
Log in
 
 
 
×
Log in