2

こんにちは、Amasty の Mass Order Actions と Orders2CSV という 2 つの拡張機能を Sales Order Grid で動作させようとしています。

現状では、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

ご覧のとおり、1 つの拡張機能がこのクラスを書き換えるため、競合はありません。

Mage_Adminhtml_Block_Sales_Order_Grid

2 つ目は、次のクラスを書き換えます。

Mage_Adminhtml_Block_Widget_Grid_Massaction

おそらく必要なのは、モジュール設定でアクションを有効にすることだけです。

于 2014-07-23T16:44:14.670 に答える