I currently don't use the cart module and have just got the number of items and total price in the header, I want to get it updated automatically with ajax once a product is purchased like in the cart module, can anyone please help? my code is below.
Code: Select all
<div class="topmenu" id="module_cart">
<?php echo $text_greeting; ?>
<?php if (!$logged) { ?>
<a href="<?php echo $login; ?>"><?php echo $text_login; ?></a> - <a href="<?php echo $create; ?>"><?php echo $text_create; ?></a>
<?php } else { ?>
<a href="<?php echo $logout; ?>"><?php echo $text_logout; ?></a> - <a href="<?php echo $account; ?>"><?php echo $text_account; ?></a>
<?php } ?>
<?php if ($products) { ?>
<a href="index.php?route=checkout/cart">(<?php echo $this->cart->countProducts(); ?>)
<?php
$count=$this->cart->countProducts();
if($count >1)
{
echo $text_shoppingbag; echo 's';
}
else echo $text_shoppingbag ?>
<?php
$count=count($totals);
$cartinfo = $totals[$count-1]['text'];
echo $cartinfo; ?>
</a>
<?php } else { ?>
<a href="index.php?route=checkout/cart">(<?php echo $this->cart->countProducts(); ?>)
<?php echo $text_shoppingbag; ?></a>
<?php
foreach ($totals as $total) {
if ($total['title'] != 'Sub-Total:') {
echo $total['text'];
}
}
} ?>
<?php if ($ajax) { ?>
<script type="text/javascript" src="catalog/view/javascript/jquery/ajax_add.js"></script>
<?php } ?>
</div>