Many times I see parent::preDispatch() or for example parent::validate() withing actions / functions of magento.

I don't really understand the concern of that parent calls. Can you explain that please on Account Controller of magento.

Today I was working with Account Controller and need to add new action.

I was overriding preDispatch method, but that override doesn't work until I commented parent::preDispatch.

I decided with the solution to replace parent::preDispatch code with Mage_Core_Controller_Front_Action::preDispatch() but not sure if that right or not.

p.s. One day I was overriding validate method of the payment method, that doesn't work also until I commented parent::validate.

1 Answer 1


When your controller call and

if you add preDispatch() function in your controller file then, first preDispatch() function is called.

In account controller preDispatch() function is there you can override that and add parent::preDispatch(); in last then add your code before parent::preDispatch();

  • but what parent::preDispatch() is actually does?
    – electroid
    Commented Oct 24, 2016 at 6:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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