0

I have extended Magento core files before but in this case wish to extend a class

//app/code/core/Mage/Tax/Model/Calculation.php
i.e. Mage_Tax_Model_Calculation

into an existing component my company had:

//app/code/local/Mycompany/Model/Companytaxrate.php
i.e. Mycompany_Companytaxrate_Model_Companytaxrate

The module Companytaxrate is already in place as is this file. How would I do this?

Oliver Williams
  • 5,966
  • 7
  • 36
  • 78

1 Answers1

0

You can extend Mage_Tax_Model_Calculation from your new model:

class Mycompany_Companytaxrate_Model_Companytaxrate extends Mage_Tax_Model_Calculation
{
}

From there, you'd rewrite the model inside your /etc/config.xml file:

<global>
  <models>
    <tax>
      <rewrite>
        <calculation>Mycompany_Companytaxrate_Model_Companytaxrate</calculation>
      </rewrite>
    </tax>
  </models>
</global>