I want to override a model file of another extension into my extension in order to develop the compatibility between the two extensions
The class I want to override is class Customweb_PostFinanceCw_Model_OrderContext extends Customweb_Payment_Authorization_OrderContext_AbstractDeprecated implements Customweb_Payment_Authorization_IOrderContext
this class also extends another class of PHP
Please help me in extending this file.
Best Answer
Below a simple example of how to override a model from one module within another module.
Please take a look at the file
app/code/local/Customweb/PostFinanceCw/etc/config.xml
for the correct use of the modulename namespace (which I can't read from your question, I usedcustomweb_postfinancecw
for now).You'd have to have a piece of XML like this in your module's
config.xml
(I named itMyCompany_MyModule
, please replace it with your own)Then, in
app/code/local/MyCompany/MyModule/Model/
, create a fileOrderContext.php
like thisYou should name the methods exactly the same as in the original
Customweb_PostFinanceCw_Model_OrderContext
class to override it's functionality. Also keep in mind to keep the same visibility (public, protected or private).