0
votes

How can I call admin controller of custom module using the following code. I have tried to search on google but was unable to find anything

Here is the code of Mynamespace/TypeChanger/Block/Adminhtml/Catalog/Product/Grid.php

   class Mynamespace_TypeChanger_Block_Adminhtml_Catalog_Product_Grid extends Mage_Adminhtml_Block_Catalog_Product_Grid
    {
         protected function _prepareMassaction()
        {
            parent::_prepareMassaction();

            // Append new mass action option
          $this->getMassactionBlock()->addItem(
                    'typechanger',
                    array('label' => $this->__('Change Type'),
                          'url'   => $this->getUrl('abc'),
         //this should be the url where there will be mass operation

                'additional' => array(
                            'visibility' => array(
                                 'name' => 'type',
                                 'type' => 'select',
                                 'class' => 'required-entry',
                                 'label' => Mage::helper('catalog')->__('Type'),
                                 'values' => array('simple' => 'simple','grouped' => 'grouped' , 'configurable' => 'configurable' ,'virtual'=> 'virtual', 'bundle'=> 'bundle', 'downloadable'=>'downloadable')
                             )

                )

               )
                );
        }
    }

here is the code for config.xml

 <?xml version="1.0"?>
    <config>
        <modules>
            <Mynamespace_TypeChanger>
                <version>1.0</version>
            </Mynamespace_TypeChanger>
        </modules>

        <admin>
            <routers>
                <typechanger>
                    <use>admin</use>
                    <args>
                        <module>Mynamespace_TypeChanger</module>
                        <frontName>abc</frontName>
                    </args>
                </typechanger>
            </routers>

        </admin>

       <global>
            <blocks>
                <adminhtml>
                    <rewrite>
                        <catalog_product_grid>Mynamespace_TypeChanger_Block_Adminhtml_Catalog_Product_Grid</catalog_product_grid>
                    </rewrite>
                </adminhtml>
            </blocks>

        <helpers>
                <typechanger>
                    <class>Mynamespace_TypeChanger_Helper</class>
                </typechanger>
        </helpers>

        </global>

    </config>
1

1 Answers

0
votes

Hi Your folder names of module is wrong.Each folder name should be start with Capital letter not small letter.Then According to Folder paths class Name should be from

mynamespace_mymodule_Block_Adminhtml_Catalog_Product_Grid

to

Mynamespace_Mymodule_Block_Adminhtml_Catalog_Product_Grid

Also from <module>mynamespace_mymodule</module> to

<module>Mynamespace_Mymodule</module>

folder path like=

Mynamespace/Mymodule/Block/Adminhtml/.../Grid.php

More study of module check this http://www.amitbera.com/create-an-magento-extension-with-custom-database-table/