Magento-如何在我的帐户导航中添加/删除链接? [英] Magento - How to add/remove links on my account navigation?

查看:75
本文介绍了Magento-如何在我的帐户导航中添加/删除链接?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试删除帐户导航上的链接.我查看了customer/account/navigation.phtml模板.该模板通过$ this-> getLinks()获取链接.如何编辑getLinks()方法,以便删除某些链接?

I am trying to remove links on my account navigation. I looked at the customer/account/navigation.phtml template. The template grabs links by $this->getLinks(). How do I edit getLinks() method so that I can remove some of links?

推荐答案

最终,这取决于您的问题.该导航中的链接是通过不同的布局XML文件添加的.这是首先在layout/customer.xml中定义块的代码.注意,它还定义了一些添加到菜单的链接:

The answer to your question is ultimately, it depends. The links in that navigation are added via different layout XML files. Here's the code that first defines the block in layout/customer.xml. Notice that it also defines some links to add to the menu:

<block type="customer/account_navigation" name="customer_account_navigation" before="-" template="customer/account/navigation.phtml">
    <action method="addLink" translate="label" module="customer"><name>account</name><path>customer/account/</path><label>Account Dashboard</label></action>
    <action method="addLink" translate="label" module="customer"><name>account_edit</name><path>customer/account/edit/</path><label>Account Information</label></action>
    <action method="addLink" translate="label" module="customer"><name>address_book</name><path>customer/address/</path><label>Address Book</label></action>
</block>

其他菜单项在其他布局文件中定义.例如,评论"模块使用layout/review.xml定义其布局,并包含以下内容:

Other menu items are defined in other layout files. For example, the Reviews module uses layout/review.xml to define its layout, and contains the following:

<customer_account>
    <!-- Mage_Review -->
    <reference name="customer_account_navigation">
        <action method="addLink" translate="label" module="review"><name>reviews</name><path>review/customer</path><label>My Product Reviews</label></action>
    </reference>
</customer_account>

要删除此链接,只需注释掉或删除<action method=...>标记,菜单项就会消失.如果要一次查找所有菜单项,请使用自己喜欢的文件搜索并找到name="customer_account_navigation"的任何实例,这是Magento用于该导航块的句柄.

To remove this link, just comment out or remove the <action method=...> tag and the menu item will disappear. If you want to find all menu items at once, use your favorite file search and find any instances of name="customer_account_navigation", which is the handle that Magento uses for that navigation block.

这篇关于Magento-如何在我的帐户导航中添加/删除链接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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