Results 1 to 7 of 7
  1. #1
    Join Date
    Nov 2006
    Location
    Sydney, Australia
    Posts
    458
    Plugin Contributions
    1

    red flag Display the Shopping Cart ICON on Header ALWAYS plus SHOW Number of items in Cart:

    Hi,
    I've looked everywhere and only seem to find very old post for much older versions of zc.
    I'm running 1.5.7c with PHP 7.3 and OPC using Responsive Classic Template.
    I would like to display the (Number of items in Cart) in the Shopping Cart Icon Header and I would like the shopping Cart Icon to display in the Header Always, even when nothing is in it.
    I'm sure this can be done I just need help with it.
    (Also, how to get the Icon also to always display in the header on mobile view, even without items in cart.)
    *Zen Cart eCommerce Solution - Putting the Dream of Owning an Online Business within reach of anyone!

  2. #2
    Join Date
    Jan 2007
    Location
    Illinois, USA
    Posts
    312
    Plugin Contributions
    0

    Default Re: Display the Shopping Cart ICON on Header ALWAYS plus SHOW Number of items in Cart

    I am using the responsive classic design with ZCA bootstrap colors. The header bar is dynamic and displays the shopping cart as a fixed bar when users scroll. Do you have any error logs being generated?
    NTO: building a better network thru collaboration
    www.needtoorder.com | www.coffeewitheinstein.com

  3. #3
    Join Date
    Nov 2006
    Location
    Sydney, Australia
    Posts
    458
    Plugin Contributions
    1

    Default Re: Display the Shopping Cart ICON on Header ALWAYS plus SHOW Number of items in Cart

    Quote Originally Posted by Carbonless View Post
    I am using the responsive classic design with ZCA bootstrap colors. The header bar is dynamic and displays the shopping cart as a fixed bar when users scroll. Do you have any error logs being generated?
    Thanks for your response, not sure if you got what I meant as there is no error regarding shopping cart or header.

    I just would like to DISPLAY the shopping cart icon in the Header to ALWAYS SHOW, not just when there are items in it (even if it's Empty).
    Also, if there ARE items in the shopping cart, I would like to DISPLAY/SHOW the NUMBER of items in the cart next to the trolley icon!
    Thanks.
    *Zen Cart eCommerce Solution - Putting the Dream of Owning an Online Business within reach of anyone!

  4. #4
    Join Date
    Nov 2006
    Location
    Sydney, Australia
    Posts
    458
    Plugin Contributions
    1

    Default Re: Display the Shopping Cart ICON on Header ALWAYS plus SHOW Number of items in Cart

    Ok I've just figured most of it out but need help from a pro please.
    I did as the responsive_classic (tpl_header.php) suggested by replacing:
    echo HEADER_TITLE_CART_CONTENTS;
    with:
    echo $_SESSION['cart']->count_contents().' item(s) '. $currencies->format($_SESSION['cart']->show_total());

    So now the Shopping Cart Icon Displays the amount of items in the Cart + the $ value of the total.

    This is almost what I wanted, so heading there but I need HELP from a zen pro with php code as I'm clueless there:
    1) I only want to show the (amount of items in cart, NOT their $ value), I tried removing quiet a few different part of the code above and trialing but couldn't get it to work, I managed to remove the text item(s) and the $ symbol and the .00 from the end but could NOT figure out how to remove the actual cost value) - it now shows eg..(cart icon 135), the 1 is for number of items in cart and the 35 is for item cost which I don't want displayed.

    2) How to Force the shopping cart box/icon to display on header ALWAYS, even when Empty!
    *Zen Cart eCommerce Solution - Putting the Dream of Owning an Online Business within reach of anyone!

  5. #5
    Join Date
    Feb 2009
    Location
    UK
    Posts
    1,239
    Plugin Contributions
    1

    Default Re: Display the Shopping Cart ICON on Header ALWAYS plus SHOW Number of items in Cart

    Quote Originally Posted by rlexyd View Post
    2) How to Force the shopping cart box/icon to display on header ALWAYS, even when Empty!
    The cart icon is wrapped in a conditional statement, i.e. only show if cart has contents. Removing that statement will cause it to always show.

    Code:
    <?php if ($_SESSION['cart']->count_contents() != 0) { ?>
        <li><a class="navCartContentsIndicator" href="<?php echo zen_href_link(FILENAME_SHOPPING_CART, '', 'NONSSL'); ?>"><i class="fa fa-shopping-cart" title="Shopping Cart"></i></a></li>
        <li class="last"><a href="<?php echo zen_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'); ?>"><i class="fa fa-check-square" title="Checkout"></i></a></li>
    <?php }?>
    Simon

  6. #6
    Join Date
    Feb 2009
    Location
    UK
    Posts
    1,239
    Plugin Contributions
    1

    Default Re: Display the Shopping Cart ICON on Header ALWAYS plus SHOW Number of items in Cart

    Quote Originally Posted by rlexyd View Post
    Ok I've just figured most of it out but need help from a pro please.
    I did as the responsive_classic (tpl_header.php) suggested by replacing:
    echo HEADER_TITLE_CART_CONTENTS;
    with:
    echo $_SESSION['cart']->count_contents().' item(s) '. $currencies->format($_SESSION['cart']->show_total());

    So now the Shopping Cart Icon Displays the amount of items in the Cart + the $ value of the total.

    This is almost what I wanted, so heading there but I need HELP from a zen pro with php code as I'm clueless there:
    1) I only want to show the (amount of items in cart, NOT their $ value), I tried removing quiet a few different part of the code above and trialing but couldn't get it to work, I managed to remove the text item(s) and the $ symbol and the .00 from the end but could NOT figure out how to remove the actual cost value) - it now shows eg..(cart icon 135), the 1 is for number of items in cart and the 35 is for item cost which I don't want displayed.
    Not a pro but, does changing,

    Code:
    echo $_SESSION['cart']->count_contents().' item(s) '. $currencies->format($_SESSION['cart']->show_total());
    to

    Code:
    echo $_SESSION['cart']->count_contents();
    do what you want?
    Simon

  7. #7
    Join Date
    Nov 2006
    Location
    Sydney, Australia
    Posts
    458
    Plugin Contributions
    1

    Default Re: Display the Shopping Cart ICON on Header ALWAYS plus SHOW Number of items in Cart

    Geez Simon, you ARE the man whether you are a pro or not
    This is Exactly what I wanted, thank you very much!!
    *Zen Cart eCommerce Solution - Putting the Dream of Owning an Online Business within reach of anyone!

 

 

Similar Threads

  1. Shopping Cart and Items in Cart in the Header
    By sendmenews in forum General Questions
    Replies: 10
    Last Post: 25 Oct 2011, 02:09 AM
  2. Show number of products in cart by shopping cart in header
    By robertwhitis in forum Templates, Stylesheets, Page Layout
    Replies: 11
    Last Post: 27 Mar 2011, 07:15 PM
  3. 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
  4. how to show only number of items in the cart?
    By chronicent in forum General Questions
    Replies: 0
    Last Post: 11 Nov 2009, 12:55 PM
  5. 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

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