Forums / Templates, Stylesheets, Page Layout / Icon to show if cart is empty/not empty

Icon to show if cart is empty/not empty

Locked

Views: 3,196

Results 1 to 2 of 2
This thread is locked. New replies are disabled.
1 Oct 2007, 4:35 PM
#1
karl19 avatar

karl19

New Zenner

Join Date:
Jun 2007
Posts:
62
Plugin Contributions:
0

Icon to show if cart is empty/not empty

Hello,

Have searched for an answer to this, but not been able to find one.

In a shop we're making, the client wants a basket icon at the top of the site. When a customer puts something in the cart, they want to swap this icon for a different one - this icon ("not empty") will stay as long as the cart is not empty.

What I'm after is a PHP-type if / else call, which says "if the cart is empty, display icon A, else display icon B". If anyone could shine some light on this, I'd be most grateful!

Many thanks,
Karl

9 Oct 2007, 9:23 AM
#2
karl19 avatar

karl19

New Zenner

Join Date:
Jun 2007
Posts:
62
Plugin Contributions:
0

Re: Icon to show if cart is empty/not empty

Stumbled upon a solution to this in a post which was really about something else - http://www.zen-cart.com/forum/showthread.php?t=44474&page=16

The code I needed was ```

<?php if ($_SESSION['cart']->count_contents() != 0) { ?>

<?php if ($_SESSION['cart']->count_contents() != 0) { echo 'IMAGE WHEN CART IS FULL'; } else { echo 'IMAGE WHEN CART IS EMPTY'; } ?>

Karl