Inscrivez-vous ou connectez-vous pour rejoindre votre communauté professionnelle.
Hi, How can I overwrite magento's core module ? What is the best way to do this? Thanks.
If you want to do it in a separate module, you should put your new model (block, helper or whatever you need to override - I'll be using the model example, its the same for the others - only the controllers are quite different) in the 'Model' directory (for instance: code/local/MyNamespace/MyModule/Model/Sales/Order.php). In your modules config.xml you should add:
<global> (...) <models> (...) <sales><rewrite><order>MyNamespace_MyModule_Model_Sales_Order</order></rewrite></sales></models> (...) </global>Of course your own Sales_Order model should inherit from the core one. This is the cleanest way to override Magento core functionality (maybe besides events, but they can't do everything).
You can find guide how to override block, controller, helper, model
http://inchoo.net/magento/overriding-magento-blocks-models-helpers-and-controllers/