Last Updated: February 25, 2016
·
433
· 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.

<?php

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

class Mycompany_Mymodule_Model_Customer
            extends Mage_Customer_Model_Customer
{
    ...
}

http://oceansgem.com/2012/12/proper-way-of-including-core-magento-class/