4
<li class="trigger-item">
      <?php $moduleName = 'wishlist';
      $cartCount = Mage::helper('checkout/cart')->getCart()->getSummaryQty();?>
        <?php if ($this->helper('wishlist')->isAllow()) : ?>
              <a class="trigger-link-wish-list" href="<?php echo $baseUrl; ?>wishlist/">
            <span class="trigger-icon icon-heart"></span>
    <?php if ($cartCount > 0): ?>
        <span class="cart-counter">
            <?php echo $cartCount; ?>
        </span>
    <?php else: ?>
        <span class="cart-counter cart-counter--zero">0</span>
    <?php endif; ?>
        </a>
  <?php endif;?>
    </li>
4

Wishlist item count is also stored in customer session.

$count = Mage::getSingleton('customer/session')->getWishlistItemCount();

For not logged in customers it's 0, so it's same as ...

 $count = 0;
 if (Mage::getSingleton('customer/session')->isLoggedIn()) {
     $count = Mage::getSingleton('customer/session')->getWishlistItemCount();
 }
0

You can try this.

<?php 
    $wishListCount = 0;
    if (Mage::getSingleton('customer/session')->isLoggedIn()){
        $customer = Mage::getSingleton('customer/session')->getCustomer();
        $wishlist = Mage::getModel('wishlist/wishlist')->loadByCustomer($customer, true);
        $wishListCount = $wishlist->getItemsCount();
    }
?>

Now $wishListCount holds what you want.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.