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:

enter image description here

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);      
                echo "Data updated successfully.";

        } catch (Exception $e){
                echo $e->getMessage(); 

1 Answer 1


Everything is correct but at the time of saving data you set all request params in setId method. Please find below line and correct it.


Replace with below code

  • Thanks for your respond. With this code I don't get the error any more, but it still saves only one value. Apr 6, 2017 at 16:58
  • Your solution is correct, I made a mistake and put it outside the loop, that's why it was only saving 1 value. Then I put it in the foreach loop and it works great :) Thank you! Apr 6, 2017 at 17:34

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.