I know this is a very simple question, but I couldn't get it to run, even if I read some tutorials.
I want to rewrite _saveProductCategories()
from Mage_ImportExport_Model_Import_Entity_Product
.
What I've done is create an empty class: app/core/local/MyNamespace/MyModule/Model/Import/Entity/Product.php
with class name MyNamespace_MyModule_Model_Import_Entity_Product
to extend the core model class. There I've put my implementation of the current function that I want to rewrite.
Then in the config.xml
of myModule I have:
<global>
<models>
<mymodule>
<class>MyNamespace_MyModule_Model</class>
</mymodule>
<importexport>
<rewrite>
<import_entity_product>MyNamespace_MyModule_Model_Import_Entity_Product</import_entity_product>
</rewrite>
</importexport>
</models>
...
But it still uses the function from the core code. What am I doing wrong?
Best Answer
To Future Readers:
The OP mentioned in their answer that they had a rewrite conflict with another third-party module. If you want your override to take precedence without refactoring third-party code you can add a module dependency.
In the app/etc/modules/MODULE_NAME.xml file add the following XML below the codePool tag
List all the modules yours needs to take precedence over. Now your overrides will take effect rather than the other modules.
Note: If you do this you'll probably want to have your classes inherit from that module's classes so that you can preserve that module's functionality.