2

您好尝试让 2 个扩展在销售订单网格、Amasty 的批量订单操作和 Orders2CSV 中工作。

就目前而言,Orders2CSV 在列表中并且工作正常。它具有以下代码来覆盖 Sales_Order_Grid:

    <?php
/**
 * Ext4mage Orders2csv Module
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Open Software License (OSL 3.0)
 * that is bundled with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/osl-3.0.php
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to Henrik Kier <info@ext4mage.com> so we can send you a copy immediately.
 *
 * @category   Ext4mage
 * @package    Ext4mage_Orders2csv
 * @copyright  Copyright (c) 2012 Ext4mage (http://ext4mage.com)
 * @license    http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
 * @author     Henrik Kier <info@ext4mage.com>
 * */ class Ext4mage_Orders2csv_Block_Sales_Order_Grid extends Mage_Adminhtml_Block_Sales_Order_Grid {  const XPATH_CONFIG_SETTINGS_IS_ACTIVE       = 'orders2csv/settings/is_active';

    protected function _prepareMassaction()     {
        parent::_prepareMassaction();
        if (Mage::getStoreConfig(self::XPATH_CONFIG_SETTINGS_IS_ACTIVE)) {

            $this->getMassactionBlock()->addItem('orders2csv', array(
                 'label'=> Mage::helper('sales')->__('Orders2CSV'),
                 'url'  => $this->getUrl('*/sales_order_orders2csv/makecsv'),
            ));
        }     } } ?>

然而,我相信 MassActions 具有以下内容,而不是覆盖它添加到其中的原始块:

<?php
/**
* @author Amasty Team
* @copyright Copyright (c) 2010-2011 Amasty (http://www.amasty.com)
* @package Amasty_Oaction
*/
class Amasty_Oaction_Block_Adminhtml_Widget_Grid_Massaction extends Mage_Adminhtml_Block_Widget_Grid_Massaction
{
    public function isAvailable()
    {
        Mage::dispatchEvent('am_grid_massaction_actions', array(
            'block' => $this,
            'page'  => $this->getRequest()->getControllerName(),
        ));  

        return parent::isAvailable();
    }    

    public function getJavaScript()
    {
        $result = new Varien_Object(array(
            'js'   => parent::getJavaScript(),
            'page' => $this->getRequest()->getControllerName(),
        ));        

        Mage::dispatchEvent('am_grid_massaction_js', array('result' => $result));

        return $result->getJs();
    }
}

知道如何将 MassAction 代码添加到 Orders2CSV 代码中吗?

任何帮助将不胜感激

安迪

4

2 回答 2

0

如您所见,没有冲突,因为一个扩展重写了此类:

Mage_Adminhtml_Block_Sales_Order_Grid

第二个重写了以下类:

Mage_Adminhtml_Block_Widget_Grid_Massaction

可能您只需要在模块设置中启用操作。

于 2014-07-23T16:44:14.670 回答
0

如果您还可以添加 config.xml,将会很有帮助。

如果两个模块都在重写(config.xml 中的 rewrite-XML-Tag),您必须更改其中一个扩展来重写另一个,这样您就有了某种链式重写。您可以在本地范围内执行此操作,以免覆盖社区文件夹中的任何文件。

于 2013-09-08T15:24:16.397 回答