6

我有一个要求,注销 url 必须仅在我的帐户底部可见,例如“帐户信息”、“地址簿”、“我的订单”等所有部分。

请查看示例图片 这个怎么做?

我应该在哪里写

action method="addLink" translate="label title" module="customer"><label>Log Out</label><url helper="customer/getLogoutUrl"/><title>Log Out</title><prepare/><urlParams/><position>100</position></action>

在我的customer.xml文件中。

4

2 回答 2

17

您可以删除 customer.xml 中的块“customer_logged_in”,然后您可以像这样在 customer.xml 中添加/制作一个块。

<reference name="content">
            <block type="page/html_wrapper" name="my.account.wrapper" translate="label">
                <label>My Account Wrapper</label>
                <action method="setElementClass"><value>my-account</value></action>
                <block type="core/template" name="logout_link" template="customer/logout_link.phtml"/>
            </block>
 </reference>

logout_link.phtml 的内容类似于,

<?php
$loggedIn = $this->helper("customer")->isLoggedIn();
if($loggedIn == 1){
    echo "<a href=\"".Mage::getBaseUrl()."customer/account/logout/\" >LOGOUT</a>";
}else{
    echo "<a href=\"".Mage::getBaseUrl()."customer/account/\" >LOGIN</a>";
}?>

……

于 2013-06-20T08:27:16.493 回答
9

最好使用这些 URL:

Mage::helper('customer')->getLogoutUrl()
Mage::helper('customer')->getLoginUrl()

它使用客户助手而不是硬编码的 URL。

于 2016-02-05T12:02:55.327 回答