First override Mage_Adminhtml_Block_Promo_Quote_Grid class and add following code
protected function _prepareMassaction()
{
$this->setMassactionIdField('rule_id');
$this->getMassactionBlock()->setFormFieldName('rule');
$this->getMassactionBlock()->addItem('delete', array(
'label' => Mage::helper('rule')->__('Delete'),
'url' => $this->getUrl('*/*/massDelete'),
'confirm' => Mage::helper('rule')->__('Are you sure?')
));
return $this;
}
then override Mage_Adminhtml_Promo_QuoteController class and add following code
public function massDeleteAction()
{ //exit;
$rulesIds = $this->getRequest()->getParam('rule');
if(!is_array($rulesIds)) {
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Please select rule(s).'));
} else {
try {
$model = Mage::getModel('salesrule/rule');
foreach ($rulesIds as $rulesId) {
//echo $rulesId; exit;
$model->load($rulesId);
$model->delete();
}
Mage::getSingleton('adminhtml/session')->addSuccess(
Mage::helper('adminhtml')->__(
'Total of %d record(s) were deleted.', count($rulesIds)
)
);
} catch (Exception $e) {
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
}
}
$this->_redirect('*/*/index');
}
protected function _prepareMassaction()
{
$this->setMassactionIdField('rule_id');
$this->getMassactionBlock()->setFormFieldName('rule');
$this->getMassactionBlock()->addItem('delete', array(
'label' => Mage::helper('rule')->__('Delete'),
'url' => $this->getUrl('*/*/massDelete'),
'confirm' => Mage::helper('rule')->__('Are you sure?')
));
return $this;
}
then override Mage_Adminhtml_Promo_QuoteController class and add following code
public function massDeleteAction()
{ //exit;
$rulesIds = $this->getRequest()->getParam('rule');
if(!is_array($rulesIds)) {
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Please select rule(s).'));
} else {
try {
$model = Mage::getModel('salesrule/rule');
foreach ($rulesIds as $rulesId) {
//echo $rulesId; exit;
$model->load($rulesId);
$model->delete();
}
Mage::getSingleton('adminhtml/session')->addSuccess(
Mage::helper('adminhtml')->__(
'Total of %d record(s) were deleted.', count($rulesIds)
)
);
} catch (Exception $e) {
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
}
}
$this->_redirect('*/*/index');
}
Magento Extension was developed to provide manual invoice sending functionality to online store owners who don’t have any other alternative. Magento extension is a big relief for online store owners as it makes the whole invoicing process much faster and easier. Magento Website Developers
ReplyDelete