Skip to content

Magento : Quick debug for template path hint & block

As a Magento Developer I think this is the best feature on magento to locate template file path & block type. Now  I will show how to use this trick to view template path hint & block.. simply use GET URL parameter, for example http://yourwebsitedomain/?your_get_var=your_get_value .

By default if you want to debug template you have to enable it on menu System->Configuration->Advanced->Developer->Template Path Hint

ok then, let’s get straight to the point


copy file app\code\core\Mage\Core\Block\Template.php




then, edit Template.php file, find function “public function getShowTemplateHints()”, replace the content with this

			if($_GET['your_get_var'] == 'your_get_value'):
			self::$_showTemplateHintsBlocks = 1;
			return self::$_showTemplateHints = 1;

        if (is_null(self::$_showTemplateHints)) {
            self::$_showTemplateHints = Mage::getStoreConfig(self::XML_PATH_DEBUG_TEMPLATE_HINTS)
                && Mage::helper('core')->isDevAllowed();
            self::$_showTemplateHintsBlocks = Mage::getStoreConfig(self::XML_PATH_DEBUG_TEMPLATE_HINTS_BLOCKS)
                && Mage::helper('core')->isDevAllowed();
        return self::$_showTemplateHints;

voila!! mission complete 😀

Comments are closed.