我必须在顶部菜单链接中添加注册链接
所以我这样做了,但我不知道注册的帮手是什么。请帮帮我
<customer_logged_in>
<reference name="top.links">
<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>
<action method="addLink" translate="label title" module="customer"><label>My Account</label><url helper="customer/getAccountUrl"/><title>My Account</title><prepare/><urlParams/><position>10</position></action>
</reference>
</customer_logged_in>
<customer_logged_out>
<reference name="top.links">
<action method="addLink" translate="label title" module="customer"><label>My Account</label><url helper="customer/getLoginUrl"/><title>My Account</title><prepare/><urlParams/><position>100</position></action>
<action method="addLink" translate="label title" module="customer"><label>Register</label><url helper="customer/getAccountUrl"/><title>Register</title><prepare/><urlParams/><position>10</position></action>
</reference>
<remove name="wishlist_sidebar"></remove>
<remove name="reorder"></remove>
</customer_logged_out>
答案 0 :(得分:14)
您所做的几乎是正确的,但您应使用customer/getAccountUrl
而不是customer/getRegisterUrl
。
所以基本上你应该在customer_logged_out\reference
<action method="addLink" translate="label title" module="customer"><label>Register</label><url helper="customer/getRegisterUrl"/><title>Register</title><prepare/><urlParams/><position>10</position></action>
所以你的代码看起来像这样:
<customer_logged_in>
<reference name="top.links">
<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>
<action method="addLink" translate="label title" module="customer"><label>My Account</label><url helper="customer/getAccountUrl"/><title>My Account</title><prepare/><urlParams/><position>10</position></action>
</reference>
</customer_logged_in>
<customer_logged_out>
<reference name="top.links">
<action method="addLink" translate="label title" module="customer"><label>My Account</label><url helper="customer/getLoginUrl"/><title>My Account</title><prepare/><urlParams/><position>100</position></action>
<action method="addLink" translate="label title" module="customer"><label>Register</label><url helper="customer/getRegisterUrl"/><title>Register</title><prepare/><urlParams/><position>10</position></action>
</reference>
<remove name="wishlist_sidebar"></remove>
<remove name="reorder"></remove>
</customer_logged_out>
希望这有助于任何人。
答案 1 :(得分:11)
使用customer/getRegisterUrl
作为帮助来获取注册网址。这意味着Magento做了这样的事情:
$helper = Mage::helper("customer"); // gets Mage_Customer_Helper_Data
$url = $helper->getRegisterUrl();
希望有所帮助。
谢谢, 乔
答案 2 :(得分:-2)
<action method="addLink"
translate="label title"
module="customer">
<label>
Register
</label>
<url helper="customer/getCreateUrl"/>
<title>Register</title>
<prepare/>
<urlParams/>
<position>100</position>
</action>