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:


But it still uses the function from the core code. What am I doing wrong?

3 Answers 3


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.


Ok, what I've done is correct. The problem was coming from the fact that a model class from a community module (that I use for the purposes of my custom module) is overriding the same class that I wanted to override in my custom module.

Therefore I rewrote that model class from the community module and it worked fine. :)


@Syspect: Rewriting the model class from the community module creates a dependency between the two modules. Now you may have problems if you need to modify one - you always have to be mindful of the other.

The dependency approach tbernard mentioned is better.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.