Last Updated: February 25, 2016
· bhupesh

Proper way of including Magento core class

Whenever, I have to rewrite the Magento core class, I use following require definition in order to include that class to avoid file not found error later when I enable Magento compiler later in production.


if ( defined('COMPILER_INCLUDE_PATH') )
    require 'Mage_Customer_Model_Customer.php';
    require 'Mage/Customer/Model/Customer.php';

class Mycompany_Mymodule_Model_Customer
            extends Mage_Customer_Model_Customer