| 2.3.3. Other important Environment variables |
| Prev | 2.3. Core Modules & their Functions, Environment Variables | Next |
|---|
The current cart contents. The array has the following structure:
[cart] ⇒ Array (
[idx] ⇒ 1
[0] ⇒ Array (
[quantity] ⇒ 1
[product_id] ⇒ 10
[description] ⇒ Size:big; Power:100W
)
)In this example, the car contains one product with the quantity of 1, the product ID 10 and a description.
The index "idx" is an integer and contains the size of
the cart (number of different products in it, regardless of
their quantity). The $cart variable is
always available in the global $_SESSION
array: $_SESSION['cart'].
All the user information in one Array, always available
in the global $_SESSION array.
[auth] ⇒ Array (
[show_prices] ⇒ 1
[user_id] ⇒ 0
[username] ⇒ demo
[perms] ⇒
[first_name] ⇒ guest
[last_name] ⇒
[shopper_group_id] ⇒ 5
[shopper_group_discount] ⇒ 0.00
[show_price_including_tax] ⇒ 1
[default_shopper_group] ⇒ 1
[is_registered_customer] ⇒
)These are the example values for a guest user (unregistered, not logged in).
Basic Session Handler & URL Formatter.
The Session Handling is done at a very basic level. If no session exists, a new session with the name "virtuemart" is started.
The ps_session class allows you to retrieve the current session ID and to restart or empty the session.
To get a properly formatted URL for use within
VirtueMart, you can use the functions url
and purl. purl is
just a wrapper for url, and prints the
URL instead of just returning it.
Example:
// Returns something like http://domain.tld/index.php?page=shop.browse&option=com_virtuemart&Itemid=54 $url = $sess->url( $_SERVER['PHP_SELF'].'?page=shop.browse' );
When SEF (Search-Engine-friendly URLs) is enabled, URLs are properly formatted using the current SEF extension.
SEF Support is currently broken when using Virtuemart on Joomla! 1.5.1.