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?