Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can i add register link in the top links in magento

Tags:

magento

I have to add Register link in the top menu links

So i did this, but i dont know whats the helper for register. Please help me

   <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>
like image 570
Elamurugan Avatar asked Apr 14 '10 14:04

Elamurugan


2 Answers

What you were doing is almost correct, but instead of customer/getAccountUrl you should use customer/getRegisterUrl.

So basically you should add the following xml line in 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>

So your code will look like this:

<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>

Hope this helps anyone.

like image 146
Dan Avatar answered Nov 10 '22 00:11

Dan


Use customer/getRegisterUrl as your helper to get the registration URL. This means that Magento do something like this:

$helper = Mage::helper("customer"); // gets Mage_Customer_Helper_Data
$url = $helper->getRegisterUrl();

Hope that helps.

Thanks, Joe

like image 21
Joe Mastey Avatar answered Nov 10 '22 01:11

Joe Mastey