I have created a custom module and need to add checkboxes to the grid and be able to delete multiple values with a mass action. Tried to use number of different articles but nothing worked. Can anyone help me to do this or maybe you know a good working article about this?
Here is the code in controller file:
public function massDeleteAction() {
$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_collection')->load($requestId);
$RequestData->delete();
}
Mage::getSingleton('adminhtml/session')->addSuccess(
Mage::helper('adminhtml')->__(
'Total of %d record(s) were successfully deleted', count($requestIds)
)
);
} catch (Exception $e) {
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
}
}
$this->_redirect('*/*/');
}
Mage::getModel('cpstest_productcomment/cps_collection')
IT seems like the model is not found.