How to find all rewrite classes in magento
How to find all rewrite classes in magento

How to find all rewrite classes in magento is a difficult task for some developer who doesn’t know the proper way to check.Why I am saying like this because previously I was checking only by get_class() method of that class if there is any other class has rewrites it or not.But some developer do by searching individual module classes to check whether the specific classes has rewrites somewhere or not,yes it is right way but time consuming task some times it can make some mistakes as you are individually opening all files of module.Here I am going to show you how you can check if any class from models,blocks,helpers has overrides or not if overrides then where that overrides.All the solution is this tutorial.I will be showing you some sorts of techniques of How to find all rewrite classes in magento. Lets all techniques.

By get_class() methods:

Suppose I would like to rewrite Mage_Sales_Model_Quote_Address class before that I have to check whether this class already overridden or not it overridden then it will make difficult to override in my own custom module as magento doesn’t support multiple inheritance.why so ? because PHP does support hierarchical inheritance as Magneto is built upon PHP so this happens.

You can check by below code:
[crayon-5e48f70f9a9f9466665571/]

By xpath:

[crayon-5e48f70f9aa03844792631/]
its will gives you all active rewrite classes.In same way if you like to check for models,blocks,helpers etc then see below codes.

Models:

[crayon-5e48f70f9aa07463858631/]

Blocks:

[crayon-5e48f70f9aa0b804863581/]

Helpers:

[crayon-5e48f70f9aa0f308791947/]
Those are simple and single line techniques through which you will getting all rewrite classes like wise.

Custom script:

[crayon-5e48f70f9aa12884966114/]
you can make it simply with any name called myScript.php and run it in browser like http://www.domain.com/myScript.php then you will be getting below result
[crayon-5e48f70f9aa16997194216/]
The above result showing that the helper “catalog/image” is overridden by Namespace_Module_Helper_Catalog_Image.If there is two more values like above result then there is a conflict means two more module override the same class.

How to find all rewrite classes in magento
The following two tabs change content below.
Jyotiranjan is one of passionate programmer who has been working in magento since 6 years and in the mean time he has developed enormous amount of modules and customisation of sites. He loves to write blogs and travel for long journeying.

Latest posts by Jyotiranjan Biswal (see all)

Tagged on:                     

Leave a Reply

Your email address will not be published. Required fields are marked *