<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>
Add a comment
|
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();
}
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.