Tuesday, March 27, 2012

Magento Mass deletion of Coupon and Mass activation of Date

For deleting or changing the "from" and "to" date of the coupon each time we have to go into each coupon and then we have to delete it or change the date Below functionality will help to do the mass deletion of the coupon and changes t he date also For that we have to copy the app/code/core/Mage/Adminhtml/Block/Promo/Quote/Grid.php into app/code/local/Mage/Adminhtml/Block/Promo/Quote/grid.php and following functions



protected function _prepareMassaction()
{
 $dateFormatIso = Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT);
 $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?’)
));
array_unshift($da, array(‘label’=>”, ‘value’=>”));

$this->getMassactionBlock()->addItem(‘date’, array(
 ‘label’=> Mage::helper(‘salesrule’)->__(‘Change Date’),
 ‘url’ => $this->getUrl(‘*/*/massDate’, array(‘_current’=>true)),
 ‘additional’ => array(
 ‘visibility’ => array(
 ‘name’ => ‘from_date’,
 ‘type’ => ‘date’,
 ‘class’ => ‘required-entry date’,
 ‘image’ => $this->getSkinUrl(‘images/grid-cal.gif’),
 ‘format’ => $dateFormatIso,
 ‘index’ => ‘from_date’,
 ‘label’ => Mage::helper(‘rule’)->__(‘From Date’)
),
array(
 ‘name’ => ‘to_date’,
 ‘type’ => ‘date’,
 ‘class’ => ‘required-entry date’,
 ‘format’ => $dateFormatIso,
 ‘index’ => ‘to_date’,
 ‘image’ => $this->getSkinUrl(‘images/grid-cal.gif’),
 ‘label’ => Mage::helper(‘rule’)->__(‘To Date’),
 //’values’ => $date
 )
)
));
return $this;
}
Clear the Cache from admin Hope this will help

No comments:

Post a Comment

Thankyou for your Comments

LinkWithin

Blog has moved, searching new blog...