For example Mage_Tax_Block_Sales_Order_Tax. This block is used on the site itself but within the admin area Mage_Adminhtml_Block_Sales_Order_Totals_Tax is used which extends from it.

Now I want to change a function of this block. To do that I wanted to rewrite it but this function will only work for the site then. The block for the admin area will still extend from the base block and not my rewrite. Do I have to rewrite both blocks (seems bad because of redundancy) or is there a more elegant way to solve this?

1 Answer 1


the rewrite mechanism is a magento feature. So you can't change the behaviour of php (which would be extending from Mage_Tax_Block_Sales_Order_Tax in your case)

In your case, you would have to rewrite the Mage_Adminhtml_Block_Sales_Order_Totals_Tax with your own block and best practice would be to extend your new block from the one you are rewriting (so Mage_Adminhtml_Block_Sales_Order_Totals_Tax)

Since this block extends the Mage_Tax_Block_Sales_Order_Tax you can also override functions of this block

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.