Magento Support – Add, Edit and Remove Magento Top Links
Magento Support – Add, Edit and Remove Magento Top Links
This is a simple trick, and often requested for Magento support. The general rule for each Magento top link is that each is mostly controlled by the Magento layout, so check layout/module_name.xml first.
To Add a new top link:
Sample code:
[codesyntax lang=”xml” lines=”fancy”]
<default> <reference name="top.links"> <action method="addLink" translate="label title" module="module_name"> <label>My Top Link Name</label> <url helper="module_name/get_top_link_target_url"/> <title>My Top Link Title</title> <prepare/> <urlParams/> <position>1</position> </action> </reference> </default>
[/codesyntax]
Note that [codesyntax lang=”xml” lines=”fancy”]
<url helper="module_name/get_top_link_target_url"/>
[/codesyntax] requires [MY_MODULE]_Helper_Data class. This can be easily created following core Magento Helper PHP files.
Also, in the config.xml, please add:
[codesyntax lang=”xml” lines=”fancy”]
<global> <helpers> <module_name> <class>[my_module]_Helper</class> </module_name> </helpers> </global>
[/codesyntax]
Edit/Remove Magento top links should be trivial after the example above.
In many cases, when you want to Remove top link, the related module is very likely to be not useful at all. It’s easier to just disable the entire module. For example, wishlist usually falls into this category.