I have this grid developed for the custom module. I added the mass delete action which works fine. But the mass Approve/Disapprove actions work only for one value, when I select multiple values I get this error. Please help to resolve this:
Here is the code for the approve function in controller file:
public function massApproveAction() {
$requestIds = $this->getRequest()->getParam('id');
if(!is_array($requestIds)) {
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Please select reqeust(s)'));
} else {
try {
foreach ($requestIds as $requestId) {
$RequestData = Mage::getModel('cpstest_productcomment/cps')->load($requestId);
$id = $this->getRequest()->getParam('id');
$data = array('comment_status'=>'Approved');
$model = Mage::getModel('cpstest_productcomment/cps')->addData($data);
}
$model->setId($id)->save();
echo "Data updated successfully.";
} catch (Exception $e){
echo $e->getMessage();
}
}
}