将新操作添加到发票的ActionList中

时间:2010-05-27 13:59:13

标签: php magento invoices

我需要在Invoices页面的ActionList中添加一个新动作 我不知道magento在哪里创建这个列表以及它如何调用所选择的动作,所以我想你们都知道我应该从哪里开始寻找......

谢谢!
乔纳森

1 个答案:

答案 0 :(得分:2)

您要覆盖的班级是Mage_Adminhtml_Block_Sales_Invoice_Grid。将该文件复制到本地空间(这样您将拥有app/code/local/Mage/Adminhtml/Block/Sales/Invoice/Grid.php),然后修改以下函数:

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;
}

希望有所帮助!

谢谢, 乔