cancel
Showing results for 
Search instead for 
Did you mean: 

button in the customer edit call custom controller

button in the customer edit call custom controller

Hi,

 

After a lot of work I succesfully put a button in the customer area, inside a new tag (the menu at the left). But now I don't know how to call my controller.

in the phtml I have:

onclick="window.location='<?php echo $this->getUrl('*/customertab/index') ?>

I tried a lot of url with each change a did in the code.

 

Controller, the same, I tried with:

app/code/local/Namespace/Customertab/controllers/Adminhtml/IndexController.php

and

app/code/local/Namespace/Customertab/controllers/IndexController.php

More with the second, into them, I had only one method indexAction with one Mage log.

the config.xml

    <admin>
        <routers>
            <namespace_customertab>
                <use>admin</use>
                <args>
                    <module>Namespace_Customertab</module>
                    <frontName>customertab</frontName>
                </args>
            </namespace_customertab>
        </routers>
    </admin>
<!-- but I tried too with -->
    <admin>
        <routers>
            <adminhtml>
                <args>
                    <modules>
                        <namespace_customertab before="Mage_Adminhtml">Namespace_Customertab_Adminhtml</namespace_customertab>
                    </modules>
                </args>
            </adminhtml>
        </routers>
    </admin>

And I tried to put an etc/adminhtml.xml

<?xml version="1.0" ?>
<config>
    <menu>
        <customertab module="namespace_customertab" translate="title">
            <title>My Custom Tab</title>
            <sort_order>100</sort_order>
            <children>
                <index module="namespace_customertab" translate="title">
                    <title>Index Action</title>
                    <sort_order>1</sort_order>
                    <action>adminhtml/customertab</action>
                </index>
            </children>
        </mycustomtab>
    </menu>
</config>

I don't try all the posibilities of course and I don't know why this doesn't work, so, any idea?

1 REPLY

Re: button in the customer edit call custom controller

First try to add folder name of  Customertab after Adminhtml folder.

app/code/local/Namespace/Customertab/controllers/Adminhtml/Customertab/IndexController.php

Reason

<namespace_customertab before="Mage_Adminhtml">Namespace_Customertab_Adminhtml</namespace_customertab>

This will land directly check after Adminhtml folder

app/code/local/Namespace/Customertab/controllers/Adminhtml/

Now change

onclick="window.location='<?php echo $this->getUrl('*/customertab/index') ?>


To

onclick="window.location='<?php echo $this->getUrl('customertab/index/') ?>



 

Find helpful ? Consider Giving Kudos to this post.
Problem solved? Click Accept as Solution!"
Qaisar Satti