Get Wishlist by CustomerId with product detail .Let see example
<?php require_once 'app/Mage.php'; Mage::app('default'); Mage::getSingleton("core/session", array("name" => "frontend")); ?> <?php if(Mage::getSingleton('customer/session')->isLoggedIn()) { $customer = Mage::getSingleton('customer/session')->getCustomer(); $customerId=$customer->getId(); $wishList = Mage::getSingleton('wishlist/wishlist')->loadByCustomer($customerId); $wishListItemCollection = $wishList->getItemCollection(); // get current currency $currency_code = Mage::app()->getStore()->getCurrentCurrencyCode(); if (count($wishListItemCollection)) { $arrProductIds = array(); foreach ($wishListItemCollection as $item) { /* @var $product Mage_Catalog_Model_Product */ $product = $item->getProduct(); $arrProductIds[] = $product->getId(); } } //print_r($arrProductIds); $countprod = count($arrProductIds); $productMediaConfig = Mage::getModel('catalog/product_media_config'); $j=0; if($countprod > 0) { foreach($arrProductIds as $prdid) { // get product category model $product2 = Mage::getModel('catalog/product')->load($prdid); // get productname if($product2->getName()!='') { $productname = $product2->getName(); }else{ $productname=''; } if($product2->getThumbnail()!='') { $thumbnailUrl = $productMediaConfig->getMediaUrl($product2->getThumbnail()); } else { $thumbnailUrl=''; } //get Product's Regular Price if($product2->getPrice()!='') { $regularprice= $product2->getPrice(); } else { $regularprice=''; } //get Product's Special price if($product2->getSpecialPrice()!='') { $specialprice= $product2->getSpecialPrice(); } else { $specialprice=''; } $productlist[$j]=array("productId"=>$prdid,"productName"=>$productname,"thumbnailUrl"=>$thumbnailUrl,"currencyCode"=>$currency_code,"regularPrice"=>$regularprice,"specialPrice"=>$specialprice); $j++; } $data['responseCode']='1'; $data['msg']='successfull'; $data['currency']=$currency_code; $data['wishlistResponse']=$productlist; } else { $data['responseCode']='0'; $data['msg']='No Wishlist Found'; } } else { $data['responseCode']='0'; $data['msg']='Please Login First'; } $data2=json_encode($data); echo $data2; ?>
EmoticonEmoticon