I'm making a simple box in the header of Joomla that displays the total quantity and total value of the cart. It works perfectly in VirtueMart, but once I leave the storefront the (Total) value is removed.

How do I fix this? I would like to set a permanent super global variable that will stay constant regardless of where the visitor is on the site.

$qty = getCartQty($_SESSION['cart']);
echo $qty;
{/source} items ($
$session = JFactory::getSession();
$session->set('gTotal', $GLOBALS[total]);
$_SESSION[gTotal] = $GLOBALS[total];

if ($_SESSION[gTotal] > 0){
$newgTotal = $session->get('gTotal');
if (($newgTotal) != 0) {
} else {
echo '0.00';

Any ideas?

How do you guys do it? Almost every site out there shows a total in the header area....

I needed the following:

$session->set('sessionTotal', $GLOBALS[total]);


$newgTotal = $_SESSION[sessionTotal];