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.

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

if ($_SESSION[gTotal] > 0){
$newgTotal = $session->get('gTotal');
}
if (($newgTotal) != 0) {
var_export($newgTotal);
} else {
echo '0.00';
}
?>
{/source})</div>

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]);

and

$newgTotal = $_SESSION[sessionTotal];
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.