Magento 1.9 – Wishlist Add/Remove Functionality

magento-1.9wishlist

In product page, I want to implement two buttons for ADD and Remove wishlist.
In my product page, I have Customer ID and Product ID.
I tried this Mage::getModel('wishlist/item')->load($id)->delete(); for remove wishlist link action.

Is it possible to implement Add to wishlist link and Remove from wishlist link in the product page.

Look I'm new in Magento.

Best Answer

Add to Wishlist:

<a href="<?php echo $this->helper('wishlist')->getAddUrl($_product) ?>" class="link-wishlist"><?php echo $this->__('Add to Wishlist') ?></a>

Remove:

<?php 
$_wishlistItem = Mage::getModel('wishlist/item')->loadByProductWishlist(
     $this->helper('wishlist')->getWishlist()->getId(),
     $_product->getId(),
     $_product->getStoreId()
);
$_wishlistRemoveUrl = $this->helper('wishlist')->getRemoveUrl($_wishlistItem); ?>
<a href="<?php echo $_wishlistRemoveUrl ?>" class="link-wishlistz"><?php echo $this->__('Remove from Wishlist') ?></a>
Related Topic