I have an extension that has a block class that extends


The extension has its own getPagerHtml(), which calls parent::getPagerHtml() at the end.

I need to make some modifications to this method in my extension, so I did a rewrite of the class in my own module, extended the class, and adding my own getPagerHtml() to it. The problem is in my class rewrite here, I need to call Mage_Catalog_Block_Product_List_Toolbar::getPagerHtml() without calling the extension's getPagerHtml(). I basically need to do something like parent::parent::getPagerHtml()

Obviously I can't modify the files in the extension. What would be the best approach to accomplish this?


Just call:


You cannot call parent::parent, in PHP, and then in Magento, you can use the static syntax to call the instatiated parent of your parent class.

So, if you have:

class A {
  public function myMethod() {
    return 4;

class B extends A {
  public function myMethod() {
    return parent::myMethod() + 1;

And you want to careate class "C" directly calling method on A, you can:

class C extends B {
  public function myMethod()
     return A::myMethod() * 2;

Class A will return "4", class B will return "5", class C will return "8".

Hope it helps.

  • Since PHP 5.4, this will cause a STRICT warning, and should be discouraged. please refer to this question: magento.stackexchange.com/questions/9693/… – ProxiBlue Jul 19 '16 at 1:01
  • @ProxiBlue No, it does not, I'm using it all the time: 3v4l.org/hGZ2l – Fabian Schmengler Jul 19 '16 at 6:45
  • I use it quite often and I never got warnings, also Magento itslef uses it. I'll deep check it. – Phoenix128_RiccardoT Jul 19 '16 at 7:28
  • Interesting. Back when i asked the question, this was the case. I will look at this again. Things may have changed. Prior to that i used the means described extensively myself. – ProxiBlue Jul 19 '16 at 10:43

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