I am trying to override


Currently I have done it successfully by copying it to:


and added my modifications. That works fine.

But instead I would prefer to have it in my own module which is structured as follows:


and in its config.xml I have:

<?xml version="1.0"?>
                        <Me_Mymodule before="Mage_Contacts">Me_Mymodule_Contacts</Me_Mymodule>

In app/code/local/Me/Mymodule/Core/Model/Domainpolicy.php I have:

class Me_Mymodule_Core_Model_Domainpolicy extends Mage_Core_Model_Domainpolicy

and the original original code with my modifications applied in one of the functions (I just add a few HTTP headers to the original content policy, no any big changes).

The problem is that when I move the modified Domainpolicy.php inside my module and extend the original class as shown (and it is no longer in app/code/local/Mage) Magento doesn't use it but runs the original one (from app/code/core). At the same time all other things which you see I have overriden in the same module work as expected.

What am I missing?

1 Answer 1


Your rewrite is not correct, plus you should put the 'core' folder with the 'Model' folder

In config.xml





 class Me_Mymodule_Model_Core_Domainpolicy extends Mage_Core_Model_Domainpolicy
  • I have done what you suggest but still doesn't work. When rewriting Reports_Model_Resource_Helper_Mysql4 I didn't need put it in app/code/local/Me/Mymodule/Model but it is directly in app/code/local/Me/Mymodule/Reports/Model/Resource/Helper/Mysql4.php. Could you please explain why in this case I need to create a reversed Model/Core directory. Shouldn't it keep the original directory tree which in app/code/core/Mage is Core/Model?
    – george
    Feb 15, 2015 at 9:29

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.