I'm working on a module and I need a block file to be overridden in order to add new functionality. I know how to override blocks, model and controllers but I want to know that what will happen if the class I'd extended was being used by another module class?

The above scenario is as follows:
In my module config.xml I'd overridden a block file as:


and override a method getEstimateRates()

but there's another module whose block file extends Mage_Checkout_Block_Cart_Shipping. My question is -

"Will that class be able to see the changes made in the overridden class in my module?"


"Do I have to override the other modules block file?"

1 Answer 1


The cleanest way to do it is to extend the class from the other module.
So leave the config.xml as it is, but make your module depend on the other one.
Add this in app/etc/Your_Module.xml as a sibling for the <codePool> tag:

    <Other_Module />

Now make your class extend the one from the other module

class Company_Module_Block_Cart_Shipping extends Other_Module_Block_Cart_Shipping {
    public function getEstimateRates() {
        //do your magic here
        //if you need to call the method from the other module class just call
        //rest of the magic here
  • so in this case will the changes reflect in other modules block? Commented May 27, 2014 at 12:06
  • The changes won't be reflected in the other module, but the application will not be using the other block anymore. Actually it will use it but only because you extend the block class. The block from the other module will never be instantiated, but you can still call methods from it. Like I suggested parent::getEstimateRates()
    – Marius
    Commented May 27, 2014 at 12:08

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.