Results 1 to 7 of 7
  1. #1
    Join Date
    Jul 2008
    Posts
    56
    Plugin Contributions
    0

    css problem hide cart info when empty

    http://www.togethersite.com/catalog/



    1. I want to make it so when the cart is empty it does not show
    items: 0 amount: o.oo in myheader but appear when it has contents. or just hide it om the Home page would probably work for me.

    2.nd How can I change its font and font color. I can't seem to fix that either.

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

    Default Re: hide cart info when empty

    Might try:
    PHP Code:
      if ($_SESSION['cart']->count_contents() > 0) {
    // do something
    } else {
    // do something else

    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!]
    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!

  3. #3
    Join Date
    Jul 2008
    Posts
    56
    Plugin Contributions
    0

    Default Re: hide cart info when empty

    nada- i tried it before i posted

    But definetly thanks it could have been it.

  4. #4
    Join Date
    Jul 2008
    Posts
    56
    Plugin Contributions
    0

    Default Re: hide cart info when empty

    here is what i need.
    http://www.liltulips.com/
    Got Baby Heels? Your Hooter Hider resource!

  5. #5
    Join Date
    Apr 2008
    Location
    London
    Posts
    596
    Plugin Contributions
    0

    Default Re: hide cart info when empty

    cheer up and try this:

    Just add it where you want and you'll get the same as the example:

    Code:
    <?php if ($_SESSION['cart']->count_contents() != 0) { ?>
        You have <?php echo $_SESSION['cart']->count_contents(); ?> <?php echo $_SESSION['cart']->count_contents() == "1" ? "item " : "items " ; ?> in your <a href="shopping_cart.html" target="_top">basket</a>
    <?php }?>

  6. #6
    Join Date
    Jul 2008
    Posts
    56
    Plugin Contributions
    0

    red flag Re: hide cart info when empty

    Here is what I have so far:::>
    <?php
    } else {
    if (STORE_STATUS == '0') {
    ?>
    <li><a href="<?php echo zen_href_link(FILENAME_LOGIN, '', 'SSL'); ?>"><?php echo HEADER_TITLE_LOGIN; ?></a></li>
    <?php } } ?>
    <?php if ($_SESSION['cart']->count_contents() != 0) { ?>
    You have <?php echo $_SESSION['cart']->count_contents(); ?> <?php echo $_SESSION['cart']->count_contents() == "1" ? "item " : "items " ; ?> in your <a href="shopping_cart.html" target="_top">basket</a>
    <?php }?>
    <?php
    if (SHOW_TOTALS_IN_CART == '0') {
    echo TEXT_TOTAL_ITEMS . '&nbsp;&nbsp;' . $_SESSION['cart']->count_contents() . '&nbsp;&nbsp;&nbsp;&nbsp;' . TEXT_TOTAL_AMOUNT . $currencies->format($_SESSION['cart']->show_total());
    }
    ?>

    <?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 }?>

    </ul>

    I just added this part of it from BIGboy:

    <?php if ($_SESSION['cart']->count_contents() != 0) { ?>
    You have <?php echo $_SESSION['cart']->count_contents(); ?> <?php echo $_SESSION['cart']->count_contents() == "1" ? "item " : "items " ; ?> in your <a href="shopping_cart.html" target="_top">basket</a>
    <?php }?>


    It doesn't seem to work unless I delete:::>

    if (SHOW_TOTALS_IN_CART == '0') {
    echo TEXT_TOTAL_ITEMS . '&nbsp;&nbsp;' . $_SESSION['cart']->count_contents() . '&nbsp;&nbsp;&nbsp;&nbsp;' . TEXT_TOTAL_AMOUNT . $currencies->format($_SESSION['cart']->show_total());
    }
    ?>


    Then I get what I want- nothing on the home page if cart is empty. EXCEPT I tested it and if not logged in or logged in and add something to cart and then select home. BAM- gone --cart is emptied all together in both options. Also when logged in the logg off options are gone also-

    can anyone help fix my code. that tulips site has it perfectly.

    No Basket info until something is added to the cart- then its there until you nav away from page or empty cart.
    Got Baby Heels? Your Hooter Hider resource!

  7. #7
    Join Date
    Jul 2008
    Posts
    56
    Plugin Contributions
    0

    Have a Drink Re: hide cart info when empty

    4am- figured it out- GOT COOKIES?- Need them for this to work!!

    Thanks Bigbadboy-

    I deleted that code and turned cookies on (my firefox dumpded all my settings some how I didn't even know until i did a re start!) and Wallah!!

    Exactly what I needed-
    Got Baby Heels? Your Hooter Hider resource!

 

 

Similar Threads

  1. View Cart (when empty)
    By Eric24v in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 19 Aug 2010, 04:53 AM
  2. shopping cart - hide the Cart Quantity Update button when not needed
    By dause in forum Templates, Stylesheets, Page Layout
    Replies: 5
    Last Post: 1 Oct 2009, 04:28 AM
  3. Shopping cart empty when adding product to cart?
    By juanitas in forum Installing on a Linux/Unix Server
    Replies: 0
    Last Post: 13 Aug 2009, 11:22 PM
  4. Empty cart when checkout CCnow
    By Macedonium in forum Addon Payment Modules
    Replies: 0
    Last Post: 18 Mar 2008, 04:21 PM
  5. Empty cart when session ends ?
    By 4ecomm in forum Customization from the Admin
    Replies: 7
    Last Post: 24 Oct 2007, 06:39 PM

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