Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / Basket Total in Top Navigation

Basket Total in Top Navigation

Views: 622

Results 1 to 3 of 3
14 May 2011, 5:58 PM
#1
logicalstep avatar

logicalstep

New Zenner

Join Date:
Jan 2011
Posts:
44
Plugin Contributions:
0

Basket Total in Top Navigation

Hi All,

Just thought I'd share this and try to give something back and in case anyone else wanted to do it...I couldn't see exactly what I wanted posted anywhere.

Very simple addition one line mod to the tpl_header.php

This is to place the Total Qty of items in the Basket and total Spend in the Top navigation bar right next to your Home, Login, Shopping Cart and Checkout text.

I used the example in this post to get what I needed:

http://www.zen-cart.com/forum/showthread.php?t=59136&highlight=items+basket&page=2

So copy your tpl_header.php from: includes\templates\template_default\common\

To:
includes\templates\YOUR_TEMPLATE\common\

Change code between:

<?php if ($_SESSION['cart']->count_contents() != 0) { ?>
    <li><a href="<?php echo zen_href_link(FILENAME_SHOPPING_CART, '', 'NONSSL'); ?>"><?php echo HEADER_TITLE_CART_CONTENTS; ?></a></li>
    <li><a href="<?php echo zen_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'); ?>"><?php echo HEADER_TITLE_CHECKOUT; ?></a></li>
<?php }?>

To:

<?php if ($_SESSION['cart']->count_contents() != 0) { ?>
    <li><a href="<?php echo zen_href_link(FILENAME_SHOPPING_CART, '', 'NONSSL'); ?>"><?php echo HEADER_TITLE_CART_CONTENTS; ?></a></li>
    <li><a href="<?php echo zen_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'); ?>"><?php echo HEADER_TITLE_CHECKOUT; ?></a></li>
	<li><a href="<?php echo zen_href_link(FILENAME_SHOPPING_CART, '', 'NONSSL'); ?>"><?php echo '    Items: ' . $_SESSION['cart']->count_contents() . '    Total: ' . $currencies->format($_SESSION['cart']->show_total()); ?></li>
	<?php }?>

It just uses the same CSS class as the existing text.

Hope this is right :wacko:

Trevor

14 May 2011, 6:08 PM
#2
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Basket Total in Top Navigation

Looks like a neat and simple way to get the information output in the desired location.
If you wanted to use multiple languages, you would convert the hard-coded text like '    Items: ' into constants that you define in a language file, similar to HEADER_TITLE_CART_CONTENTS.

15 May 2011, 8:14 PM
#3
logicalstep avatar

logicalstep

New Zenner

Join Date:
Jan 2011
Posts:
44
Plugin Contributions:
0

Re: Basket Total in Top Navigation

Haha, I'm not that advanced yet! But it looks simple enough, thanks for the tip. :)

Trevor