在 Magento 中查找正确的模板和块

2023-12-07

我正在尝试更改 Magento 单页结帐页面。我已经搜索过

$find . -iname *onepage*

我在 Magento/ 目录中得到了 5-6 个 onepage.phtml 结果。其中几个页面具有完全相同的来源,或几乎完全相同的来源。有没有更好的方法让我知道哪个文件正在加载到网站上,而不是使用“火力试验”方法并编辑它们,直到找到我需要的文件?


You have the option of using Template Hints. This is a very nifty tool for Magento developers. Template hints will show where to find every visible file on every page of your Magento site. Log into the back end and follow the pictures to see how to turn them on for the front end. enter image description here-dont wanna enter image description here enter image description here Set both Template Path Hints and Add Block Names to Hints to yes. and Voila, you're site should be looking something like this: (Also, Template Path Hints are not shown in the default site scope by default, you may need to select a specific site to enable them for): enter image description here

现在,如果您需要对后端(管理面板)进行更改怎么办?尽管您必须对某些代码进行一些更改,但这部分也同样简单。在你的

app/code/local/Mage/Core/etc/system.xml

目录中有一段代码,如下所示:

                        <template_hints translate="label">
                        <frontend_type>select</frontend_type>
                        <source_model>adminhtml/system_config_source_yesno</source_model>
                        <sort_order>20</sort_order>
                        <show_in_default>0</show_in_default>
                        <show_in_website>1</show_in_website>
                        <show_in_store>1</show_in_store>
                    </template_hints>
                    <template_hints_blocks translate="label">
                        <label>Add Block Names to Hints</label>
                        <frontend_type>select</frontend_type>
                        <source_model>adminhtml/system_config_source_yesno</source_model>
                        <sort_order>21</sort_order>
                        <show_in_default>0</show_in_default>
                        <show_in_website>1</show_in_website>
                        <show_in_store>1</show_in_store>
                    </template_hints_blocks>

现在将 show_in_default 设置从 0 更改为 1。返回到默认站点范围下的管理面板 > 系统 > 配置 > 开发人员,您将可以选择启用模板路径提示和块名称。如果您现在将这两个设置为“是”,它将启用管理面板的模板路径提示。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

在 Magento 中查找正确的模板和块 的相关文章

随机推荐