I am trying to extend default PayPal Express functionality. I have successfully rewritten app/code/core/Mage/Paypal/Model/Config.php like


But cannot find the way to overwrite

public function returnAction()
    try {
    catch (Mage_Core_Exception $e) {
    catch (Exception $e) {
        Mage::getSingleton('checkout/session')->addError($this->__('Unable to process Express Checkout approval.'));

in app/code/core/Mage/Paypal/Controller/Express/Abstract.php

I have tried using an observer in the event controller_action_predispatch_paypal_express_return and its triggered when customer come back from PayPal page but I don't see anything that allows me to intercept this method and rewrite it.


2 Answers 2


We cannot overwrite an Abstract class.

Instead we can achieve what we want by overwriting

Mage_Paypal_ExpressController` controller

There we can overwrite the method(s).

Hope this helps.

                        <Namespace_Paypal before="Mage_Paypal">Namespace_Paypal</Namespace_Paypal>

Now copy Abstract.php from core folder to app/code/local/Mage/Paypal/Controller/Express/Abstract.php

Edit this file in the following way.


abstract class Namespace_Paypal_Express_Abstract extends Mage_Paypal_Controller_Express_Abstract
     public function returnAction()
        //your custom code

I've not been able to test the code, so please let me know if it works.

Please refer to the following link to override a controller



  • Please can you put the relevant code as the answer. Then refer to the link. If the link becomes stale, the answer will be pointless in the future.
    – ProxiBlue
    Oct 28, 2014 at 6:19
  • 1
    Thanks for your answer but there should be a more optimal way to handle this. Perhaps using controller dispatch events like @philwinkle recommend in magento.stackexchange.com/questions/9754/…
    – diazwatson
    Oct 30, 2014 at 0:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.