Page 1 of 2 12 LastLast
Results 1 to 10 of 12
  1. #1
    Join Date
    Mar 2011
    Posts
    42
    Plugin Contributions
    0

    Default Show number of products in cart by shopping cart in header

    I am using v1.3.9h.

    I was wondering if anyone knows of a way to display the total number of products that are currently in the cart by the shopping cart text in the header.

    Basically, it would display like:

    Shopping Cart (3)

    Perhaps I'm missing something simple, but when I looked inside the default template files, this information was displayed along with other information, and all I want is that number!

    Any help would be appreciated.

    Thanks in advance!


  2. #2
    Join Date
    Apr 2006
    Location
    Ohio
    Posts
    6,162
    Plugin Contributions
    0

    Default Re: Show number of products in cart by shopping cart in header

    Robert,
    You will find this as a free addon to zen cart.. It is location on a link at the top of this page called Free Software Add Ons..
    Mark
    Hare Do

  3. #3
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Show number of products in cart by shopping cart in header

    If you look at how the totals are built for the top of the shopping cart page in the:
    /includes/modules/pages/shopping_cart/header_php.php

    you will see the code for:
    Code:
    $totalsDisplay = '';
    switch (true) {
      case (SHOW_TOTALS_IN_CART == '1'):
      $totalsDisplay = TEXT_TOTAL_ITEMS . $_SESSION['cart']->count_contents() . TEXT_TOTAL_WEIGHT . $shipping_weight . TEXT_PRODUCT_WEIGHT_UNIT . TEXT_TOTAL_AMOUNT . $currencies->format($_SESSION['cart']->show_total());
      break;
      case (SHOW_TOTALS_IN_CART == '2'):
      $totalsDisplay = TEXT_TOTAL_ITEMS . $_SESSION['cart']->count_contents() . ($shipping_weight > 0 ? TEXT_TOTAL_WEIGHT . $shipping_weight . TEXT_PRODUCT_WEIGHT_UNIT : '') . TEXT_TOTAL_AMOUNT . $currencies->format($_SESSION['cart']->show_total());
      break;
      case (SHOW_TOTALS_IN_CART == '3'):
      $totalsDisplay = TEXT_TOTAL_ITEMS . $_SESSION['cart']->count_contents() . TEXT_TOTAL_AMOUNT . $currencies->format($_SESSION['cart']->show_total());
      break;
    }
    It could be that the code to display these has been removed from your template ...

    This is how that is displayed on the shopping_cart page in the default:
    Code:
    <?php if (!empty($totalsDisplay)) { ?>
      <div class="cartTotalsDisplay important"><?php echo $totalsDisplay; ?></div>
      <br class="clearBoth" />
    <?php } ?>
    Perhaps from that information you can get the parts you need ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.5]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  4. #4
    Join Date
    Mar 2011
    Posts
    42
    Plugin Contributions
    0

    Default Re: Show number of products in cart by shopping cart in header

    Thanks haredo, that was perfect and so painless!

    Much thanks to you for pointing me in the right direction!


  5. #5
    Join Date
    Apr 2006
    Location
    Ohio
    Posts
    6,162
    Plugin Contributions
    0

    Default Re: Show number of products in cart by shopping cart in header

    Ro,
    You are most welcome but is it Ajeh that who will teach you how to locate the core and understand .php to write your own script ...
    Mark
    Hare Do

  6. #6
    Join Date
    Mar 2011
    Posts
    42
    Plugin Contributions
    0

    Default Re: Show number of products in cart by shopping cart in header

    I understand PHP pretty well, but before I go reinventing the wheel I usually just ask when I'm dealing with a new script (first website I've used Zen Cart on).

    I try to reserve doing my own digging and investigating to situations that are very specific to my needs.

    I figured this was a simple fix that tons of people wanted, I was unable to find it by doing a search, so I posted a thread.

    The link you provided - the file wasn't a full mod, just a text file with the php code in it, which was only a line or two.

    Not to say I don't appreciate Ajeh's response, but the code to display that information had not been removed from my script, and the snippet he posted actually displays the full order totals information, such number of items, total weight, and total price.

    All I wanted was that single number, and the link you provided was to a file that included code to get just that number.


  7. #7

    Default Re: Show number of products in cart by shopping cart in header

    Ajeh's snippet was for the total items, weight, and amount in the shopping cart header right? Could someone please point me to the right file and the right part to put that code in so I can have total items and total amount showing up in the shopping cart header.
    Many thanks in advance :)

    (www.scarletburn.co.uk)

  8. #8
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Show number of products in cart by shopping cart in header

    Did you try the setting in the Configuration ... Layout Settings ...
    Shopping Cart - Show Totals
    Show Totals Above Shopping Cart?
    0= off
    1= on: Items Weight Amount
    2= on: Items Weight Amount, but no weight when 0
    3= on: Items Amount
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.5]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  9. #9

    Default Re: Show number of products in cart by shopping cart in header

    I have tried adding the addon "shopping_cart_totals_in_header_1-1" which works perfect for what I need, but how do I change the colour of the text so it shows up on my site?

  10. #10
    Join Date
    May 2009
    Posts
    1,219
    Plugin Contributions
    2

    Default Re: Show number of products in cart by shopping cart in header

    but how do I change the colour of the text so it shows up on my site?
    In the stylesheet perhaps ... a link to your site would help.

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. How can I display the number of items in shopping cart in header
    By sharontan in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 1 Dec 2010, 02:03 PM
  2. Show Product Quantity In Shopping Cart In Header?
    By mcqueeneycoins in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 29 May 2010, 05:14 PM
  3. Replies: 2
    Last Post: 24 May 2010, 04:40 PM
  4. Need shopping cart link to always show in header
    By sandstoner in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 17 Sep 2008, 03:42 PM
  5. Code to show model number in shopping cart?
    By bugyoutoo in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 14 Mar 2008, 07:17 AM

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