How to override rate.php in magento enterprise or magento 1.8? -


i need change app\code\core\mage\tax\model\calculation\rate.php

if (!is_numeric($this->getrate()) || $this->getrate() <= 0) { 

to

if (!is_numeric($this->getrate()) || $this->getrate() < 0) { 

so want override file in stead of changing in core folder.

please help....

first of need rewrite core magento model in config.xml file of custom module:

<config>     <modules>         <mypackage_mymodule>             <version>0.0.1</version>         </mypackage_mymodule>     </modules>      <global>         <models>             <mypackage_mymodule>                 <class>mypackage_mymodule_model</class>             </mypackage_mymodule>             <tax>                 <rewrite>                <calculation_rate>mypackage_mymodule_model_calculation_rate</calculation_rate>                   </rewrite>             </tax>         </models>     </global> </config> 

than need create new rate.php file here: mypackage/mymodule/model/calculation/rate.php , extend core magento tax rate model. @ end should add method need. can test if rewrite successful this:

class mypackage_mymodule_model_calculation_rate extends mage_tax_model_calculation_rate {       /**      * prepare location settings , tax postcode before save rate      *      * @return mage_tax_model_calculation_rate      */      protected function _beforesave()     {          die("it works!");     } } 

now, when new method works, can add code wish.

hope helps! :)


Comments

Popular posts from this blog

java - Intellij Synchronizing output directories .. -

git - Initial Commit: "fatal: could not create leading directories of ..." -