In previous versions of Magento the top links, i.e.
- My Account
- My Wishlist
- My Cart
- Checkout
- Log In
were called in:
In this file, the $toplinks
array was looped through and a list of links are echoed. The proper way to then add extra links to this array is by the addLink
method in the appropriate layout file. As some of you will notice this is similar in fashion to the footer links as I described in a previous post.
The block that was used to define the toplink could be found in:
This has now been deprecated, and the toplinks now follow the more generic links template in:
So, if you were ever tempted to just hack an <li>
element in the top links foreach loop, there’s no doing that any more you naughty girls and boys! Use Magento’s built in awesomeness, that’s why it’s there!</p>
As an example, in a recent /layout/page.xml
file I had the code below to add “help” and “contact us” links.
Easy as pie.