Add these to your custom module controller:
class Some_Module_IndexController extends Mage_Core_Controller_Front_Action
{
//Check if customer logged in
public function preDispatch()
{
parent::preDispatch();
if (!Mage::getSingleton('customer/session')->authenticate($this)) {
$this->setFlag('', self::FLAG_NO_DISPATCH, true);
}
}
public function downloadWishlistAction()
{
/**
* @var $wishlist Mage_Wishlist_Model_Wishlist
* @var $item Mage_Wishlist_Model_Item
*/
$wishlist = Mage::getModel('wishlist/wishlist');
$wishlist = $wishlist->loadByCustomer(Mage::getSingleton('customer/session')->getCustomer());
$items = $wishlist->getItemCollection();
$data = array(
'Id',
'Product Id',
'Name',
'Price',
'Qty',
'Added',
'Store',
);
$fp = fopen('php://temp', 'r+');
fputcsv($fp, $data, ',', '"');
foreach ($items as $item) {
$data = array(
'id' => $item->getId(),
'product_id' => $item->getProductId(),
'product_name' => $item->getProduct()->getName(),
'product_price' => $item->getProduct()->getPrice(),
'qty' => $item->getQty(),
'added_at' => $item->getAddedAt(),
'store_name' => Mage::app()->getStore($item->getStoreId())->getName(),
);
fputcsv($fp, $data, ',', '"');
}
rewind($fp);
$data = fread($fp, 1048576);
fclose($fp);
return $this->_prepareDownloadResponse(
'MyWishList.csv',
$data,
'application/csv'
);
}
}
And customer can download own wishlist entering yourdomain.com/module_frontend/index/downloadWishlist