【问题标题】:Add new Action to invoice's ActionList向发票的 ActionList 添加新操作
【发布时间】:2010-05-27 13:59:12
【问题描述】:

我需要在发票页面的 ActionList 中添加一个新操作
我不知道 magento 在哪里创建此列表以及它如何调用所选操作,所以我想你们会知道我应该从哪里开始查找...

谢谢!
乔纳森

【问题讨论】:

    标签: php magento invoices


    【解决方案1】:

    您要覆盖的类是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;
    }
    

    希望有帮助!

    谢谢, 乔

    【讨论】:

    • 非常感谢!您的解决方案唯一的小问题是它不是本地目录,而是核心文件夹...
    • 正如我在帖子开头所说的,将文件从核心文件夹复制到本地目录。如果修改核心版本,下次升级脚本时会被覆盖。在本地文件夹中(或者甚至更好,如果您在模块中使用一个覆盖该块),您可以更安全地解决该问题并且可以升级。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-11-09
    • 2014-02-18
    • 2021-10-29
    • 1970-01-01
    • 2014-01-13
    • 1970-01-01
    相关资源
    最近更新 更多