It’s time to override Magento controller

I’m quite happy to override Magento models and blocks. Since overriding controllers is different from overriding models and blocks, I do not want to touch it until recently.

What I was trying to achieve was a customised product view page which could show different content according to url parameters and login status.

At first, it was Block detecting url parameters and login status. If the criteria did not meet, Block add an error message and show default content. Then I found this error message would not show up (until next page) because this Block was after Message Block.

So, for the sake of logic, I have to rewrite the product view controller. And it makes more sense if I conduct a redirect rather than show default content if the criteria do not meet.

Leave a comment

Your email address will not be published. Required fields are marked *