我要求退出网址必须仅在我的帐户底部可见,对于每个部分,例如"帐户信息","地址簿","我的订单"类似于所有部分.
这该怎么做?
我应该在哪里写
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>
Run Code Online (Sandbox Code Playgroud)
在我的customer.xml文件中.
Dus*_*shi 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>
Run Code Online (Sandbox Code Playgroud)
而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>";
}?>
Run Code Online (Sandbox Code Playgroud)
....
最好使用这些URL:
Mage::helper('customer')->getLogoutUrl()
Mage::helper('customer')->getLoginUrl()
Run Code Online (Sandbox Code Playgroud)
它使用客户帮助程序而不是硬编码URL.
| 归档时间: |
|
| 查看次数: |
21944 次 |
| 最近记录: |