Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6616449
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T20:35:01+00:00 2026-05-25T20:35:01+00:00

I have a controller in Magento as below: #File: ./app/local/FilFact/Test/IndexController class FilFact_Test_IndexController extends Mage_Core_Controller_Front_Action{

  • 0

I have a controller in Magento as below:

#File: ./app/local/FilFact/Test/IndexController
class FilFact_Test_IndexController extends Mage_Core_Controller_Front_Action{
    public function indexAction(){
        $this->_testConfig();
    }
}

I need to add two events for:
before index action
after index action

How could I do that?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T20:35:02+00:00Added an answer on May 25, 2026 at 8:35 pm

    This is simple as the Mage_Core_Controller_Varien_Action base class provides pre/post dispatch events.

    If you open up the Mage_Core_Controller_Varien_Action class you find two methods: preDispatch() and postDispatch()

    These method perform a few tasks and most importantly fire off three events.

    controller_action_(pre|post)dispatch
    controller_action_(pre|post)dispatch_{{routeName}}
    controller_action_(pre|post)dispatch_{{fullActionName}}
    

    The fullActionName is the route name, the controller name, and the action name separated by ‘_’ and all lower case. (See Mage_Core_Controller_Varien_Action::getFullActionName for reference)

    /app/code/local/FilFact/Test/etc/config.xml

    <?xml version="1.0"?>
    <config>
        <modules>
            <FilFact_Test>
                <version>1.0.0</version>
            <FilFact_Test>
        </modules>
        <global>
            <models>
                <FilFact_Test>
                    <class>FilFact_Test_Model</class>
                </FilFact_Test>
            </models>
        </global>
        <frontend>
            <routers>
                <filfact>
                    <use>standard</use>
                    <args>
                        <module>FilFact_Test</module>
                        <frontName>filfact</frontName>
                    </args>
                </filfact>
            </routers>
            <events>
                <controller_action_predispatch_filfact_index_index>
                    <observers>
                        <FilFact_Test>
                            <class>FilFact_Test/Observer</class>
                            <method>indexPreDispatch</method>
                        </FilFact_Test>
                    </observers>
                </controller_action_predispatch_filfact_index_index>
                <controller_action_postdispatch_filfact_index_index>
                    <observers>
                        <FilFact_Test>
                            <class>FilFact_Test/Observer</class>
                            <method>indexPostDispatch</method>
                        </FilFact_Test>
                    </observers>
                </controller_action_postdispatch_filfact_index_index>
            </events>
        </frontend>
    </config>
    

    /app/code/local/FilFact/Test/Model/Observer.php

    <?php
    class FilFact_Test_Model_Observer
    {
        public function indexPreDispatch(Varien_Event_Observer $observer)
        {
           // TODO: Your code
        }
    
        public function indexPostDispatch(Varien_Event_Observer $observer)
        {
           // TODO: Your code
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have controller and it has following code: class Company_ModuleName_NameController extends Mage_Core_Controller_Front_Action { public
i have controller class UserController (in controller folder) which extends BaseController (present in app
I have a controller with an action method as follows: public class InventoryController :
I have created a modules: app/code/local/MyStore/Welcome And in this module, I have a controller
I have a basic Magento (PHP app, using index.php as the controller) setup on
I have this controller set up for a login: <?php class Login extends Controller
I have a controller (address /Home/Test see below) which definately responds to get request
I have multiple controller actions that takes an id public ActionResult Get(int? id) {
I have a controller defined as: [AcceptVerbs(HttpVerbs.Post)] public JsonResult PostMoreData(DataContracts.Address address, DataContracts.GeoLocation geoLocation) {
I have controller which extends Controller_Template , and also i have quite few functions

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.