Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2011
    Posts
    44
    Plugin Contributions
    0

    Default 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/showth...+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 Code:
    <?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 Code:
    <?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 '&nbsp;&nbsp;&nbsp;&nbsp;Items: ' $_SESSION['cart']->count_contents() . '&nbsp;&nbsp;&nbsp;&nbsp;Total: ' $currencies->format($_SESSION['cart']->show_total()); ?></li>
        <?php }?>
    It just uses the same CSS class as the existing text.

    Hope this is right

    Trevor

  2. #2
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default 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 '&nbsp;&nbsp;&nbsp;&nbsp;Items: ' into constants that you define in a language file, similar to HEADER_TITLE_CART_CONTENTS.

  3. #3
    Join Date
    Jan 2011
    Posts
    44
    Plugin Contributions
    0

    Default Re: Basket Total in Top Navigation

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

    Trevor

 

 

Similar Threads

  1. Show tax/VAT & total in basket/cart
    By scottbrown_14 in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 22 Nov 2009, 01:25 PM
  2. Customers basket total
    By jynxy in forum General Questions
    Replies: 2
    Last Post: 20 Feb 2008, 01:15 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg