$this->getMassactionBlock()->addItem('complete_order', array( 'label'=> Mage::helper('sales')->__('Complete'),'url' => $this->getUrl('*
public function massCompleteAction()
{
$orderIds = $this->getRequest()->getPost('order_ids', array());
$countCompleteOrder = 0;
foreach ($orderIds as $orderId) {
$order = Mage::getModel('sales/order')->load($orderId);
if ($order->canComplete()) {
$order->complete()
->save();
$countCompleteOrder++;
}
}
if ($countCompleteOrder>0) {
$this->_getSession()->addSuccess($this->__('%s order(s) successfully put on complete', $countCompleteOrder));
}
else {
// selected orders is not available for hold
}
$this->_redirect('*
public function canComplete()
{
if ($this->getState() === self::STATE_CANCELED ||
$this->getState() === self::STATE_CLOSED
) {
return false;
}
if ($this->getActionFlag(self::ACTION_FLAG_COMPLETE) === false) {
return false;
}
return true;
}
public function complete()
{
if (!$this->canComplete()) {
Mage::throwException(Mage::helper('sales')->__('Complete action is not available'));
}
$this->setHoldBeforeState($this->getState());
$this->setHoldBeforeStatus($this->getStatus());
$this->setState(self::STATE_COMPLETE, true);
return $this;
}