22
votes

I want to enable template path hints in admin panel. I know how to do it for the front end, but for back end?? I actually want to edit the admin panel .

Thanks in advance..

9

9 Answers

46
votes

You can do it by changing the database directly. If you have something like phpMyAdmin that is a good way to gain access. Enter this SQL.

INSERT INTO `core_config_data` (`scope`, `scope_id`, `path`, `value`)
       VALUES ('websites', '0', 'dev/debug/template_hints', '1');

When you are done with path hints just delete the matching record from core_config_data Or update the value field to 0 instead of deleting the whole record, it will probably be the last one since you've just added it.

35
votes

You can enable template and block path hints in every store (including the admin store) by setting them in the Magento configuration. To do this, simply edit your module's configuration file config.xml (which gets injected into Magento's global configuration).

To enable template and block path hints in the admin area add this to your config.xml file

<config>

    ...

    <stores>
        <admin>
            <dev>
                <debug>
                    <template_hints>1</template_hints>
                    <template_hints_blocks>1</template_hints_blocks>
                </debug>
            </dev>
        </admin>
    </stores>

</config>

To disable path hints simply change to 0, or delete the node.

9
votes

open /app/etc/local.xml and add the follow code

<config>

    ...

    <websites>
        <admin>
            <dev>
                <debug>
                    <template_hints>1</template_hints>
                    <template_hints_blocks>1</template_hints_blocks>
                </debug>
            </dev>
        </admin>
    </websites>
</config>
6
votes

The feature wasn't designed to be used on the admin. Its system config is explicitly set to only allow you to se this at the website or store level, not the global level.

Assuming this is just for work in a development environment, the approach I'd take would be to override the class

Mage_Core_Block_Template

and override (with a class alias override, or a local/Mage replacement) the getShowTemplateHints method hints.

public function getShowTemplateHints()
{
     //return false
     return true; 
}

//     old method, here for demo purposes only.  Don't hack the core
//     public function getShowTemplateHints()
//     {
//         if (is_null(self::$_showTemplateHints)) {
//             self::$_showTemplateHints = Mage::getStoreConfig('dev/debug/template_hints')
//                 && Mage::helper('core')->isDevAllowed();
//             self::$_showTemplateHintsBlocks = Mage::getStoreConfig('dev/debug/template_hints_blocks')
//                 && Mage::helper('core')->isDevAllowed();
//         }
//         return self::$_showTemplateHints;
//     }

You can then manually change getShowTemplateHints to return true or false if you want the feature on or off, or add whatever additional logic you wanted.

I would not recommend you push this change to the production server.

2
votes

You can use the following extension in order to enable the template path hints for frontend & backend easily & securly in a joomla way:
http://www.magepsycho.com/easy-template-path-hints.html

2
votes

A quite handy solution: Modify getShowTemplateHints() function defined in \app\code\core\Mage\Adminhtml\Block\Template.php file as below:

To run below function: In your browser type, http://www.mymagentosite.com/?th=1&token=PHP

You can see template hints and added Block Names.

public function getShowTemplateHints()
{
    if (is_null(self::$_showTemplateHints))
    {
        self::$_showTemplateHints = Mage::getStoreConfig('dev/debug/template_hints')
            && Mage::helper('core')->isDevAllowed();
        self::$_showTemplateHintsBlocks = Mage::getStoreConfig('dev/debug/template_hints_blocks')
            && Mage::helper('core')->isDevAllowed();
    }

    // overwrite the template hint [SPECIALLY FOR SHOWING TEMPLATE PATH HINTS IN ADMIN]
    $th     = Mage::app()->getRequest()->getParam('th', false);
    $token  = Mage::app()->getRequest()->getParam('token', false);
    if($th == 1 && $token == 'PHP'){
        self::$_showTemplateHints = true; // for template path
        self::$_showTemplateHintsBlocks = true; // block names
    }

    return self::$_showTemplateHints;
}
2
votes

I know it's late but you can do it easily this way: Just change settings in the configuration file www/app/code/core/Mage/Core/etc/system.xml

Set sections>dev>debug>fields>template_hints>show_in_default to 1 and set sections>dev>debug>fields>template_hints_blocks>show_in_default to 1 too

1
votes

Go to your Database and Just run this query:

INSERT INTO core_config_data (scope, scope_id, path, value)
VALUES ('default', 0, 'dev/debug/template_hints', 1),
('default', 0, 'dev/debug/template_hints_blocks', 1);

To disable them again, run this query:

UPDATE core_config_data set value = 0 where scope = 'default' and scope_id = 0 and path ='dev/debug/template_hints'

To enable again run this query:

UPDATE core_config_data set value = 1 where scope = 'default' and scope_id = 0 and path ='dev/debug/template_hints'
-3
votes

I don't think you should make it too difficult, let 's make it easy by easy steps. You can look at the instruction here about How to turn on template path hints in Magento