Daily Archives: October 3, 2013


How to Add Massactions into Magento’s Grid?

Today I have got solutions regarding How to Add Massactions into Magento’s Grid? It is very easy to add Massaction in magento. Step 1 open your [Namespace]/[Modulename]/Block/Adminhtml/[module]/Grid.php file and extend the functionality. so we have to add one method _prepareMassaction() as below.

protected function _prepareMassaction()
$this->getMassactionBlock()->addItem('delete', array(
'label'=> $this->__('Delete'),
'url'  => $this->getUrl('*/*/massDelete', array('' => '')),
'confirm' => $this->__('Are you sure you want to delete the selected listing(s)?')
return $this;

Step 2 : When you add above code you will see the grid as below image.


Step 3 : Now add Delete funtion code in  [Namespace]/[Modulename]/Block/Adminhtml/[module]Controller.php and write below code.

public function massDeleteAction()
$adListingIds = $this->getRequest()->getParam('[module]_id');

if(!is_array($adListingIds)) {
Mage::getSingleton('adminhtml/session')->addError($this->__('Please select Ad Listing(s).'));
} else {
try {
$model = Mage::getSingleton('/');
foreach ($adListingIds as $adId) {
Mage::getSingleton('adminhtml/session')->addSuccess($this->__('Total of %d record(s) were deleted.', count($adListingIds)));
} catch (Exception $e) {

Step 4: If you are follow above steps and you can achieve this functionality on your custom grid.