Jonathan
Jonathan

Reputation: 4918

Add new Action to invoice's ActionList

I need to add a new action to the ActionList in the Invoices page
I don't know where magento creates this list and how it call the selected action, so I thought you guys would know where I should start looking...

Thanks!
Jonathan

Upvotes: 1

Views: 1025

Answers (1)

Joe Mastey
Joe Mastey

Reputation: 27119

The class you want to override is Mage_Adminhtml_Block_Sales_Invoice_Grid. Copy that file into the local space (so you'll have app/code/local/Mage/Adminhtml/Block/Sales/Invoice/Grid.php) and then modify the following function:

protected function _prepareMassaction()
{
    $this->setMassactionIdField('entity_id');
    $this->getMassactionBlock()->setFormFieldName('invoice_ids');

    $this->getMassactionBlock()->addItem('pdfinvoices_order', array(
         'label'=> Mage::helper('sales')->__('PDF Invoices'),
         'url'  => $this->getUrl('*/*/pdfinvoices'),
    ));

    // your action goes here
    $this->getMassactionBlock()->addItem('handle', array(
         'label'=> Mage::helper('sales')->__('Your Action Label'),
         'url'  => $this->getUrl('path/to/your/action'),
    ));  

    return $this;
}

Hope that helps!

Thanks, Joe

Upvotes: 2

Related Questions