Start networking and exchanging professional insights

Register now or log in to join your professional community.

Follow

What is the best way to overwrite Magento's Core Module ?

Hi, How can I overwrite magento's core module ? What is the best way to do this? Thanks.

user-image
Question added by Muhammad Zeshan , Web Application Developer , Inquiron
Date Posted: 2013/11/05
Atif Aqeel
by Atif Aqeel , Founder And Director , Xesense

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).

Sunit Ardeshna
by Sunit Ardeshna , Sr. Magento Developer , Innovify

You can find guide how to override block, controller, helper, model

http://inchoo.net/magento/overriding-magento-blocks-models-helpers-and-controllers/

More Questions Like This

Do you need help in adding the right keywords to your CV? Let our CV writing experts help you.