Friday, September 22, 2017

Magento 1: How to override Paypal Model in your custom module

Task: Need to overrite magento paypal model method in your custom module

Solution:
For example, need to override /app/code/core/Mage/Paypal/Model/Config.php  method getBuildNotationCode

Create model in your extantion

app/code/local/YourFirm/ExtName/Model/Paypal/Config.php

code:

class YourFirm_ExtName_Model_Paypal_Config extends Mage_Paypal_Model_Config
{
    public function getBuildNotationCode($countryCode = null)
    {
        ... your code here....
       // if you need, you could run base function, use: parent::getBuildNotationCode($countryCode);
    }
}


open confix.xml in your extantion
/app/code/local/YourFirm/ExtName/etc/config.xml

and add next code in global section:

and add next code in global section:
    <global>
        <models>
            <paypal>
             <rewrite>
              <config>YourFirm_ExtName_Model_Paypal_Config</config>
             </rewrite>
            </paypal>            
        </models>
    </global>

           
           
                  

No comments:

Post a Comment

Restore xampp database from backup

steps: stop mysql xampp 1 - create some backup folder "data_1"  2 - from your current xampp/mysql/data folder move core folders an...