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>
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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With