1 way: to copy directory structure of core block to local code pool and copy core block file. For example : app/code/core/Mage/Catalog/Block/Navigation.php to app/code/local/Mage/Catalog/Block/Navigation.php. And then and needed methods.

2 way: Configure rewrite in this way:


And then extend my class from magento core class.

Which way is more correct?


The second way is the correct one.

The first way is generally used if you have to correct a real Magento bug (and there is no patch available).

Finally, I would say that it is sometimes unnecessary to rewrite a block : you can create your own block (that extends the core one) and call yours in the layout declaration : <block type="your_alias/navigation" ...

Edit : I have to add that there is a difference between a rewrite (way 1) and an override (way 2). See this question . So, my answer is more adapted to the question "How to rewrite a core block correctly ?"...

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.