When I remove an item from wishlist, I need to get the product id of that item. Anyone please help me on this.
See my code below:
config.xml
<wishlist_item_save_after>
<observers>
<data_wishlist_delete>
<class>data/observer</class>
<method>deleteFromWishlist</method>
</data_wishlist_delete>
</observers>
</wishlist_item_save_after>
Observer.php
public function deleteFromWishlist()
{
$item = Mage::app()->getRequest()->getParam('item');
$action = Mage::app()->getRequest()->getActionName();
if (($action == 'remove') && !empty($item)) {
$resource = Mage::getSingleton('core/resource');
$readConnection = $resource->getConnection('core_read');
$query = 'SELECT product_id FROM wishlist_item WHERE wishlist_item_id = ' . $item . ' LIMIT 1';
$id = $readConnection->fetchOne($query);
echo 'Product Id: ' . $id . '<br/>';
} else {
return;
}
}
The product id is not getting here is because the record in the wishlist_item table is deleting when we remove an item from wishlist.