2

我有一个扩展客户帐户部分的自定义模块。我添加了一个名为“我的上传”的新链接。此链接显示在“我的帐户”链接侧边栏的底部。在索引页面上,“我的上传”链接以粗体显示且不可选择。但是,在我的子页面上,没有一个链接是粗体或可选择的。我正在搜索如何在我的自定义模块中保持相同的链接功能(即所有父页面和子页面都显示相同的侧边栏链接为活动状态。)_SetActiveMenu 似乎只是管理控制器中可访问的方法,所以我真的不知道有什么办法去做这个。有人有任何线索吗?

4

2 回答 2

2

如果我没记错的话,您想在客户“我的帐户”侧边栏中添加一个链接。因此,navigation.php在控制这些链接的 /app/code/local/themename/customer/block/account/navigation.php 中可用。文件中的函数很少,其中一些:

public function isActive($link)  
{
if (empty($this->_activeLink)) {
    $this->_activeLink = $this->getAction()->getFullActionName('/');
}
if ($this->_completePath($link->getPath()) == $this->_activeLink) {
    return true;
}
return false;
} 


public function setActive($path)
{
    $this->_activeLink = $this->_completePath($path);
    return $this;
}
于 2012-01-08T21:08:32.160 回答
0

你可以在你的布局中做到这一点。名为“changepassword”的链接示例:

<mycompany_changepassword_index_index translate="label">
    <label>Change Password Page</label>
    <update handle="customer_account"/>
    <reference name="my.account.wrapper">
        <block type="customer/form_edit" name="mycompany_changepassword" template="mycompany/changepassword.phtml">
            <reference name="customer_account_navigation">
                <action method="setActive"><path>changepassword</path></action>
            </reference>
        </block>
    </reference>
</mycompany_changepassword_index_index>
于 2018-02-08T09:00:34.600 回答