Results 1 to 8 of 8
  1. #1
    Join Date
    Sep 2008
    Posts
    99
    Plugin Contributions
    0

    Default Shopping cart totals on all pages?

    Hi All
    I'm trying to display the cart totals in navmain on all pages. eg. Total Items: 1 Amount: £38.29. I can get it to work if I paste

    <li class="cartTotalsDisplay important"> <?php echo $totalsDisplay; ?></li>

    into the navmain div in tpl_header. But, it only appears on the shopping cart page. I'm guessing that $totalsDisplay isn't available in pages other than the shopping cart - is this correct?. How can I ensure it always appears in navmain on any page?

    The site is here

    NB you have to add something to the cart to get to the Shopping Cart page.
    Thank you!, Steve

  2. #2
    Join Date
    May 2006
    Posts
    45
    Plugin Contributions
    0

    Default Re: Shopping cart totals on all pages?

    for number of items in cart:

    HTML Code:
    <li><?php echo $_SESSION['cart']->count_contents() . HEADER_TITLE_CART_ITEMS; ?></li>
    for total amount in cart:

    HTML Code:
    <li><?php echo HEADER_TITLE_CART_AMOUNT . $currencies->format($_SESSION['cart']->show_total()); ?></li>
    These are not copied/pasted, so there might be mistakes. Hope this helps though.

  3. #3
    Join Date
    Sep 2008
    Posts
    99
    Plugin Contributions
    0

    Default Re: Shopping cart totals on all pages?

    Thanks jarsa

    That almost worked but I needed to define HEADER_TITLE_CART_ITEMS and HEADER_TITLE_CART_AMOUNT. I used your suggestion with a slight modification. ie I added

    <li><?php echo TEXT_TOTAL_ITEMS, $_SESSION['cart']->count_contents(); ?></li>
    <li><?php echo TEXT_TOTAL_AMOUNT, $currencies->format($_SESSION['cart']->show_total());

    to the navmain section in tpl_header and then copy and pasted the definitions from shopping_cart.php to my custom english.php

    define('TEXT_TOTAL_ITEMS', 'Total Items: ');
    define('TEXT_TOTAL_AMOUNT', '&nbsp;&nbsp;Amount: ')

    Thanks for your help!

  4. #4
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: Shopping cart totals on all pages?

    There's a cart-contents addon in the Free Addons area which can be used as content for your header or as a sidebox. You might look at it for inspiration.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  5. #5
    Join Date
    Sep 2008
    Posts
    99
    Plugin Contributions
    0

    Default Re: Shopping cart totals on all pages?

    Thanks DrByte. Will do
    Steve

  6. #6
    Join Date
    Nov 2008
    Posts
    2
    Plugin Contributions
    0

    help question Re: Shopping cart totals on all pages?

    Very helpful answer for pages within zen cart, but how would I go about displaying this information on pages on my website outside of the zencart folder?

    I am putting
    Code:
    <p>Shopping Cart [ <?php echo $_SESSION['cart']->count_contents(), TEXT_TOTAL_ITEMS; ?> ]</p>
    but this only outputs "Shopping Cart [", basically getting stuck at the php code.

    What can I put in the code of these external pages to tell them where to find the zencart data/variables?

    Thanks!

  7. #7
    Join Date
    Jun 2003
    Posts
    33,715
    Plugin Contributions
    0

    Default Re: Shopping cart totals on all pages?

    Are your outside pages .php?
    Please do not PM for support issues: a private solution doesn't benefit the community.

    Be careful with unsolicited advice via email or PM - Make sure the person you are talking to is a reliable source.

  8. #8
    Join Date
    Nov 2008
    Posts
    2
    Plugin Contributions
    0

    Default Re: Shopping cart totals on all pages?

    Yes, they are all .php pages.

 

 

Similar Threads

  1. Shopping cart totals outsite folder
    By DannyVarley in forum Templates, Stylesheets, Page Layout
    Replies: 4
    Last Post: 28 Feb 2013, 07:54 PM
  2. v139h can I include shopping cart contents on all checkout pages?
    By linjuming in forum General Questions
    Replies: 3
    Last Post: 18 Jun 2012, 01:06 PM
  3. 'Shopping Cart Totals in Header' Clickable
    By rrzc in forum All Other Contributions/Addons
    Replies: 1
    Last Post: 19 Aug 2010, 12:53 AM
  4. Shopping Cart Totals in Header Support
    By georgiepants in forum All Other Contributions/Addons
    Replies: 5
    Last Post: 8 Feb 2010, 04:23 PM
  5. Shopping Cart Totals ??
    By AvieLF in forum General Questions
    Replies: 5
    Last Post: 19 Dec 2006, 09:09 PM

Bookmarks

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
Zen-Cart, Internet Selling Services, Klamath Falls, OR