The Very Best Way to Edit Magento Top Links
In the past, we have explored the ways which let you add, edit and remove Magento Top Links. Now, we have discovered an even better way to edit Magento Top Links. Yes, you read that right. We have an even better way to manage Magento Top Links.
If you need to refresh your memory, Magento Top Links are the links you see in the header section of an eCommerce website. Examples of these are: My Cart, My Account, My Wishlist, and so on. As many of you Magento experts know, the programming methods are constantly being revised. This is to assure that Magento users can have the best experience utilizing the service as they possibly can. Us Magento users can’t argue with that, can we?
This new and improved way of editing links allows you to edit top files without having to edit core layout files, which may change when you update Magento utilizing a local .xml file. Even better, you can add our own custom links without even touching any template files. For those of you who are experiencing that Friday afternoon, brain-dead feeling, a custom link is when you customize the ending of a link to something which is more memorable or more simple to type. Thereby, you are changing the random ending that is generated by your computer program. Custom links are also referred to as vanity URLs. Not to worry though, assuring that your link is memorable is not vain but sensible. Since its specific terminology will attract more focalized attention to your site.
This is an example of a normal link: https://www.harapartners.com/hpblog/
However, a customized link would look like this: https://www.harapartners.com/hpblog/use-vsnap-increase-online-sales/
So, now that we have refreshed your memory, let’s move on to the template file aspect. Templates are the files which control how your WordPress site will be displayed on the worldwide web. These files collect information from your WordPress material to create the HTML code. This code is sent to the web browser. The theme system on WordPress lets you determine as many templates as you like under the one theme.
This way to edit Magento Top Links is a more effective way than the previous one we have told you about. It is easier for you and is a smarter way of doing things.
Editing Magento Top Links in Local.xml:
<!– Add custom links. Pretty self-explanatory.
Dig into app/code/core/Mage/Page/Block/Template/Links.php for more info –>
<action method=”addLink” translate=”label title”>
<url>about</url> <!– can use full url also –>
<prepare>true</prepare> <!– set true if adding base url param –>
<urlParams helper=”core/url/getHomeUrl”/> <!– base url – thanks @Russ! –>
<!– there are a few param you can send to do different things in <urlParams>
dig into app/code/core/Mage/Core/Model/Url.php, around line 803 –>
<!– below adds #add-fragment to the end of your url –>
<!– <urlParams><_fragment>add-fragment</_fragment></urlParams> –>
<!– below adds ?add-query to the end of your url –>
<!– <urlParams><_query>add-fragment</_query></urlParams> –>
<!– below gives you a new session id (i think…)–>
<!– <urlParams><_nosid>true</_nosid></urlParams> –>
<!– below replaces double quotes, single quotes, greater than, and less than signs
to their respective url escaped replacements (%22, %27, %3E, %3C) –>
<!– <urlParams><_escape>i’m-a-blog-url</_escape></urlParams> –>
<!– Removes ‘My Account’ link – Default position: 10 –>
<action method=”removeLinkByUrl”><url helper=”customer/getAccountUrl”/></action>
<!– Removes ‘Wishlist’ link – Default position: 20 –>
<!– for Magento 1.3.x –>
<action method=”removeLinkByUrl”><url helper=”wishlist/”/></action>
<!– for Magento 1.4.x –>
<!– Removes ‘My Cart’ AND ‘Checkout’ links
Default position: 40 and 50 respectively –>
<!– To re-add ‘My Cart’ or ‘Checkout’ after removing both –>
<block type=”checkout/links” name=”checkout_cart_link_custom”>
<!– Removes ‘Log In’ link – Default position: 60 –>
<action method=”removeLinkByUrl”><url helper=”customer/getLoginUrl”/></action>
<!– Removes ‘Log Out’ link – Default position: 60 –>
<action method=”removeLinkByUrl”><url helper=”customer/getLogoutUrl”/></action>