1

I am developer, new to magento, and I just took over a project from another dev team so the code is totally strange to me. They built a custom module, and I have trouble figuring out when/where a certain action from inside a controller is triggered.

Here is the file structure/path: app -> code -> local -> FOLDER -> MODULE FOLDER -> controllers -> IndexController.php Inside this index controller lies the indexAction() action.

When is this action triggered? What should I look for? Any idea is helpful

1

After you enable the module, there is config.xml file for each module(which is at NAMESPACE/MODULENAME/etc/config.xml), there should be something like this:

<config>  
....

<frontend>
        <routers>
            <MODULENAME>
                <use>standard</use>
                <args>
                    <module>NAMESPACE_MODULENAME</module>
                    <frontName>path</frontName>
                </args>
            </MODULENAME>
        </routers>  
    </frontend>

...
</config>

According to your, Question you can reach controllers with following url: http://DOMAIN_NAME/path/index/index Here the path is from config.xml's , first index is IndexController and second index is method(action) indexAction() in IndexController.

P.S: -> FOLDER -> MODULE FOLDER ==> NAMESPACE -> MODULENAME

| improve this answer | |
  • and if I wanted to do a php redirect to that indexAction(), how would that look like? – odin Jan 21 '15 at 20:39
  • if you want to redirect from another controller to indexAction() then use: $this->_redirect('path/index/index'); from other Mage::app()->getResponse()->setRedirect(Mage::getUrl("path/index/index")) – Prakash Thapa Jan 21 '15 at 20:47
  • did it solve your problem? if so please mark as if so please mark as solved. – Prakash Thapa Jan 21 '15 at 20:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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