Communiquez avec les autres et partagez vos connaissances professionnelles

Inscrivez-vous ou connectez-vous pour rejoindre votre communauté professionnelle.

Suivre

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 ajoutée par Muhammad Zeshan , Web Application Developer , Inquiron
Date de publication: 2013/11/05
Atif Aqeel
par 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
par 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

Avez-vous besoin d'aide pour créer un CV ayant les mots-clés recherchés par les employeurs?