如何在magento的顶部链接中添加注册链接

Ela*_*gan 7 magento

我必须在顶部菜单链接中添加注册链接

所以我做了这个,但我不知道什么是登记的帮手.请帮我

   <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>
Run Code Online (Sandbox Code Playgroud)

Dan*_*Dan 14

你在做什么几乎是正确的,但customer/getAccountUrl你应该使用customer/getRegisterUrl.

所以基本上你应该添加以下xml行 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>
Run Code Online (Sandbox Code Playgroud)

所以你的代码看起来像这样:

<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>
Run Code Online (Sandbox Code Playgroud)

希望这有助于任何人.


Jos*_*tey 11

使用customer/getRegisterUrl作为助手,以获得注册URL.这意味着Magento做了这样的事情:

$helper = Mage::helper("customer"); // gets Mage_Customer_Helper_Data
$url = $helper->getRegisterUrl();
Run Code Online (Sandbox Code Playgroud)

希望有所帮助.

谢谢,乔