I've got a module with this rewrite in Magento to change the checkout url in a nice way:

<blocks> <checkout> <rewrite> <onepage_link>RD_ModuleName_Block_Onepage_Link</onepage_link> </rewrite> </checkout> </blocks>

And this block:

<?php class RD_ModuleName_Block_Onepage_Link extends Mage_Checkout_Block_Onepage_Link { public function getCheckoutUrl() {
if($something === TRUE){ return $this->getUrl('someurl', array('_secure'=>true)); } return parent::getCheckoutUrl(); } }

This works perfectly. But I'd like to disable this module for one store so I've disabled it in the backend (configuration -> advanced). After this the complete checkout button is gone! Why? It looks like when there is a rewrite and the module output is disabled the rewrite stays but the block will not be rendered and it doesn't fallback to the original class (in this case Mage_Checkout_Block_Onepage_Link).

I've done some research, my own getCheckoutUrl() is never called but when I put a constructor in my class that one will be called. When I put some logging in the original Mage_Checkout_Block_Onepage_Link class; no function there is called, when I put a constructor in it for testing, that one will be called.

Is this normal behavior of Magento or is it a bug? When it's normal, what other options do I have to accomplish the same in a nice way?

1 Answer 1


It is caused by a misunderstanding regarding the use of "Disable modules output" configuration section.

Setting the value of your module to "Disabled" here DOES NOT disable your module, it only disables the modules output.

Thus, the HTML that is supposed to be returned by your module is always an empty string, that's probably why your button disappeared.

Here is a quick look at Mage_Core_Block_Abstract:

final public function toHtml()
    Mage::dispatchEvent('core_block_abstract_to_html_before', array('block' => $this));
    if (Mage::getStoreConfig('advanced/modules_disable_output/' . $this->getModuleName())) {
        return '';

As you can see, an empty string si being returned if the module output is disabled.

To fully disable a module, you need to use the app/etc/modules/Namespace_Module.xml file, there is no other way.

I suggest you add a configuration flag to your module using system.xml file. Something like "Enable/Disable".

Thus, you can modify your block like this:

class RD_ModuleName_Block_Onepage_Link extends Mage_Checkout_Block_Onepage_Link
    public function getCheckoutUrl()

        if($something === TRUE && Mage::getStoreConfigFlag('module/options/enable'){
            return $this->getUrl('someurl', array('_secure'=>true));
        return parent::getCheckoutUrl();
  • Thanks for you great answer! I'm going to create a enable/disable configuration option for my module.
    – Roy
    Commented Oct 2, 2015 at 9:14

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.