I want to get all the product ids from wishlist in magento. I tried with below code but I am getting only one product id.
public function GetWishlistProductId($productId)
{
$customer = Mage::getModel('customer/customer')->getCollection()->addAttributeToSelect('*');
$wishList = Mage::getModel('wishlist/wishlist')->loadByCustomer($customer);
$wishListItemCollection = $wishList->getItemCollection();
if (count($wishListItemCollection)) {
$arrProductIds = array();
foreach ($wishListItemCollection as $item) {
/*@var $product Mage_Catalog_Model_Product */
$product = $item->getProduct();
$arrProductIds[] = $product->getId();
foreach ($arrProductIds as $key => $val){
if($productId == $val){
$pval=$val;
}
}
}
}
return($pval);
}