ابدأ بالتواصل مع الأشخاص وتبادل معارفك المهنية

أنشئ حسابًا أو سجّل الدخول للانضمام إلى مجتمعك المهني.

متابعة

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
تم إضافة السؤال من قبل Muhammad Zeshan , Web Application Developer , Inquiron
تاريخ النشر: 2013/11/05
Atif Aqeel
من قبل 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
من قبل 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/

المزيد من الأسئلة المماثلة