Search code examples
magentomethodsoverloading

Overload Library Class Methods with Magento 1.6v or higher


I have Magento version 1.6 and I want to like overload a method in a class which is located in {root}/lib folder. I have seen that there are no problems If I want to overload magento methods in the {root}/app/code/mage folder.

But my problem is, how can I overload specific methods in a class from magento library lib folder?


Solution

  • AFAIK, the only way to override the lib class file is to use the same folder structure as that of lib in app/code/local pool.
    For example if you want to override

    lib/Varien/Image.php
    

    then you should copy the file to:

    app/code/local/Varien/Image.php
    

    But in case of lib class's method overriding. i don't think if that's possible unless you modify the autoload classes.

    Thanks