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?
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.
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
/app/code/local/FilFact/Test/Model/Observer.php