Remove a product having productid $productId of a customer having customerid $customerId
<?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(); $productId=$_REQUEST['productId']; if($_REQUEST['productId']) { $itemCollection = Mage::getModel('wishlist/item')->getCollection()->addCustomerIdFilter($customerId); $countcollection=count($itemCollection); if($countcollection>0) { foreach($itemCollection as $item) { if($item->getProduct()->getId() == $productId){ $item->delete(); } } $data['responseCode']='1'; $data['msg']='Removed Product From Wishlist Successfully'; } else { $data['responseCode']='0'; $data['msg']='No Wishlist Found'; } } else { $data['responseCode']='0'; $data['msg']='Please Select Product'; } } else { $data['responseCode']='0'; $data['msg']='Please Login First'; } $data2=json_encode($data); echo $data2; ?>
EmoticonEmoticon