在管理页面中启用模板路径提示 - Magento

Dam*_*ran 22 php api magento e-commerce

我想在管理面板中启用模板路径提示.我知道如何为前端做到这一点,但对于后端?我其实想要编辑管理面板.

提前致谢..

clo*_*eek 46

您可以通过直接更改数据库来完成此操作.如果你有像phpMyAdmin这样的东西,这是获得访问权限的好方法.输入此SQL.

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

当您完成路径提示时,只需删除匹配的记录core_config_data或者更新value字段0而不是删除整个记录,它可能是您刚刚添加它的最后一个.


fxx*_*fxx 35

您可以通过在Magento配置中设置模板和块路径提示来在每个商店(包括管理存储区)中启用它们.为此,只需编辑模块的配置文件config.xml(将其注入Magento的全局配置).

要在管理区域中启用模板和阻止路径提示,请将其添加到您的config.xml文件中

<config>

    ...

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

</config>
Run Code Online (Sandbox Code Playgroud)

要禁用路径提示,只需更改为0,或删除节点.


Ben*_*Roe 9

打开/app/etc/local.xml并添加以下代码

<config>

    ...

    <websites>
        <admin>
            <dev>
                <debug>
                    <template_hints>1</template_hints>
                    <template_hints_blocks>1</template_hints_blocks>
                </debug>
            </dev>
        </admin>
    </websites>
</config>
Run Code Online (Sandbox Code Playgroud)


Ala*_*orm 6

该功能并非设计用于管理员.它的系统配置明确设置为只允许您在网站或商店级别,而不是全局级别.

假设这仅适用于开发环境中的工作,我采用的方法是覆盖该类

Mage_Core_Block_Template
Run Code Online (Sandbox Code Playgroud)

和覆盖(使用类别名覆盖,或本地/ Mage替换)getShowTemplateHints方法提示.

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;
//     }
Run Code Online (Sandbox Code Playgroud)

然后,如果要打开或关闭该功能,或者添加所需的任何其他逻辑,则可以手动更改getShowTemplateHints以返回true或false.

我不建议您将此更改推送到生产服务器.