1

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.

1 Answer 1

1

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>
2
  • Thanks for your answer. But the remove wishlist is not working. When I click on the remove link it will redirect to the page itself and nothing happens. Feb 22, 2016 at 12:05
  • Updated my answer and tested it, it should be working now Feb 22, 2016 at 12:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.