3

How to Add Additional Drop-down in Mass-action.

Example if I select Delete in Mass-action it also Ask Reason in another Drop-down for Delete.

0

1 Answer 1

1

I think you have to create a small extension ...

  1. Add this to you config.xml

    <adminhtml>
        <events>
            <adminhtml_block_html_before>
                <observers>
                    <your_handle>
                        <type>singleton</type>
                        <class>[model]/observer</class>
                        <method>addMassactionToProductGrid</method>
                    </your_handle>
                </observers>
            </adminhtml_block_html_before>
        </events>
    </adminhtml>
    
  2. and for your Observer.php

    public function addMassactionToProductGrid($observer)
    {
        $block = $observer->getBlock();
        if ($block instanceof Mage_Adminhtml_Block_Catalog_Product_Grid) {
            $attributes = ...
    
            $block->getMassactionBlock()->addItem(
                'my_massaction',
                array(
                    'label'      => Mage::helper('catalog')->__('Update Attribute Values'),
                    'url'        => $block->getUrl('*/*/mycontrolleraction', array('_current' => true)),
                    # this add the additional dropdown
                    'additional' => array(
                        'attribute' => array(
                            'name'   => 'attribute',
                            'type'   => 'select',
                            'class'  => 'required-entry',
                            'label'  => Mage::helper('catalog')->__('Delete Reason'),
                            'values' => array(
                                array(
                                    'value' => 'Some Value',
                                    'label' => 'Your Label'
                                )
                            )
                        )
                    )
                )
            );
        }
    
        return $this;
    }
    

Note: this example is for admin product grid, but it should work for other grids too. Just change Mage_Adminhtml_Block_Catalog_Product_Grid to you grid type.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.