2

I need to override one function from the following file: Mage/Adminhtml/Block/Widget/Grid/Massaction/Abstract.php

The function that needs to be overriden is getJavaScript().

I have tried at least three different solutions from SE, however, none of them seemed to produce any outcome.

1
  • please share your code
    – Piyush
    Jan 3, 2017 at 15:17

3 Answers 3

4

Abstract class cannot be override in magento.

If you want to change the code in Abstract class, There will be a solution that

Copy your file to local codePool.

Just copy

app/code/core/Mage/Adminhtml/Block/Widget/Grid/Massaction/Abstract.php

to

app/code/local/Mage/Adminhtml/Block/Widget/Grid/Massaction/Abstract.php

and make changes at that local file

2

You can't rewrite an abstract class because is not instantiated. The rewrite system works because Magento uses a factory pattern to instantiate model, blocks, and helpers

The solution is you should to override and not rewrite so you copy the file from a core to local codepool.

1
  • +1 for explaining why the rewrite system doesn't work
    – Akif
    Dec 4, 2017 at 14:50
1

Copy this file from core/Mage/Adminhtml/Block/Widget/Grid/Massaction/Abstract.php to local/Mage/Adminhtml/Block/Widget/Grid/Massaction/Abstract.php and edit the function in the local copy.

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.