0

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?

1
Contributor
2
Replies
3
Views
6 Years
Discussion Span
Last Post by mpw5013
0

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

0

I needed the following:

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

and

$newgTotal = $_SESSION[sessionTotal];
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.