在Magento中找到正确的模板和块 [英] Finding Correct Templates and Blocks in Magento

查看:57
本文介绍了在Magento中找到正确的模板和块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I'm trying to make a change to the Magento onepage checkout page. I've done a search

$find . -iname *onepage*

,我在Magento/目录中获得了5-6个onepage.phtml的结果.这些页面中有几个页面具有完全相同的来源,或者几乎具有完全相同的来源.与使用逐次尝试"方法并对其进行编辑直到找到所需的文件相比,有什么更好的方法让我知道该文件正在加载到站点上?

and I've gotten 5-6 results for onepage.phtml in my Magento/ directory. A couple of these pages have the exact same source, or nearly the exact same source. Is there a better way for me to know which one is the file being loaded onto the site than using a "trial by fire" method and editing them until I find which one I'm needing?

推荐答案

您可以选择使用模板提示.对于Magento开发人员来说,这是一个非常漂亮的工具.模板提示将显示您在Magento网站每一页上哪里可以找到每个可见文件.登录到后端,然后按照图片查看如何在前端将其打开. 将模板路径提示"和将块名称添加到提示"都设置为是".和Voila,您的网站应该看起来像这样:(此外,默认情况下默认情况下,模板路径提示未显示在默认网站范围中,您可能需要选择一个特定的网站才能启用它们):

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. 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):

现在,如果您需要更改后端(管理面板)怎么办?尽管您将必须对某些代码进行一些更改,但这部分几乎同样容易.在您的

Now what if you need to make changes to the back end (administration panel)? This part is about just as easy, although you will have to make some changes to some code. In your

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

目录中的代码块如下所示:

directory there is a block of code that will look like:

                        <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.返回默认站点范围下的管理面板>系统>配置>开发人员,您将具有启用模板路径提示和块名称的选项.如果您现在将两者都设置为是",它将为管理面板启用模板路径提示.

Now change both of the show_in_default settings from 0 to 1. Return to the admin panel > System > Configuration > Developer under the default site scope and you will have the options to enable template path hints and block names. If you set both of those to yes now, it will enable template path hints for the administration panel.

这篇关于在Magento中找到正确的模板和块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆