help i have searched every piece in the forum and found nothing on adding the shopping cart in the header. i know it can be done with 1.3 because i have seen it done can anyone help me with this.
help i have searched every piece in the forum and found nothing on adding the shopping cart in the header. i know it can be done with 1.3 because i have seen it done can anyone help me with this.
Code:<?php if (SHOW_TOTALS_IN_CART == '0') { echo TEXT_TOTAL_ITEMS . ' ' . $_SESSION['cart']->count_contents() . ' ' . TEXT_TOTAL_AMOUNT . $currencies->format($_SESSION['cart']->show_total()); } ?>
thank you kim you rock that is why i needed
I tried adding the lines above to tpl.header.php but the cart total is not showing in the header. Do I need to do anything else?
thank you,
lbrown
Hi,
I changed a few bits and use this code.
tpl_header ->
<?php if ($_SESSION['cart']->count_contents() > 0) {
$products = $_SESSION['cart']->get_products();
echo '<p><a href="/index.php?main_page=shopping_cart">' . $_SESSION['cart']->count_contents().' Item(s) - Total: £';
echo $currencies->format($_SESSION['cart']->show_total());
}
if ($_SESSION['cart']->count_contents() == 0) {
$products = $_SESSION['cart']->get_products();
echo '<p><a href="/index.php?main_page=shopping_cart"> Item(s) £0.00';
}
?></a></p>
Hope this helps.![]()
Kims' code does work but only if you have set your admin settings (configuration>layout settings>Shopping Cart (show totals) to 0, ie OFF. You can easily change this by removing the IF statement altogether so the basket summary always shows in the header OR change the code to read
<?php
if (SHOW_TOTALS_IN_CART != '0') {
echo TEXT_TOTAL_ITEMS . ' ' . $_SESSION['cart']->count_contents() . ' ' . TEXT_TOTAL_AMOUNT . $currencies->format($_SESSION['cart']->show_total());
}
?>
Ok - Im going to show how little I know about this stuff....
Where should I paste this code in order to show the cart summary in my header section ?
Help would be a life saver !
Jaz
You should update the file includes/templates/template_default/common/tpl_header.php and place in your override directory (ie includes/templates/yourOverrideDirectory/common).
thanks sparkle
Hey everyone,
I am only getting the total number of different products in the cart. Although, many of my products are quantity based. Is there a way to edit the total number to be of quantity products, and not just products??
thanks in advance.
Code:<li>My Cart: <span class="style1"> <?php echo sizeof($_SESSION['cart']->get_products()); ?> items <?php $header_cart = $currencies->format($_SESSION['cart']->show_total()); echo $header_cart; ?> </span> <br class="clearBoth" /> </li>