Many developers want change the default structure of top links inside Magento , example you want remove my account link or edit URL of checkout link other play with label or title of log In log Out .
This tutorial is for how done this work :
1- First go to app/design/frontend/default/yourtheme/layout
2- Edit Remove Override :
– Edit top Links :
My Account
Open customer.xml . and find this code:
1 2 3 4 5 6 |
<default>
<!-- Mage_Customer -->
<reference name="top.links">
<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>
</default>
|
You can change the
To change the link URL play inside url tag:
Log In
Open customer.xml . and find this code:
1 2 3 |
<reference name="top.links">
<action method="addLink" translate="label title" module="customer"><label>Log In</label><url helper="customer/getLoginUrl"/><title>Log In</title><prepare/><urlParams/><position>100</position></action>
</reference>
|
Log Out
Open customer.xml . and find this code:
1 2 3 |
<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>
</reference>
|
My Whishlist
Open wishlist.xml . and find this code:
1 2 3 4 |
<reference name="top.links">
<block type="wishlist/links" name="wishlist_link"/>
<action method="addLinkBlock"><blockName>wishlist_link</blockName></action>
</reference>
|
My Cart and Checkout
My Cart and Checkout links can not be modified in the XML files. You can only remove them from the header menu. The code for these links is located in the checkout.xml file:
1 2 3 4 5 6 |
<reference name="top.links">
<block type="checkout/links" name="checkout_cart_link">
<action method="addCartLink"></action>
<action method="addCheckoutLink"></action>
</block>
</reference>
|
– Remove Top link:
To remove “My Wishlist” link, edit wishlist.xml and comment
1 2 3 4 5 |
<!--<reference name="top.links">
<block type="wishlist/links" name="wishlist_link" />
<action method="addLinkBlock"><blockName>wishlist_link</blockName></action>
</action>
</reference>-->
|
To remove “My Cart” and “Checkout” links, edit checkout.xml
1 2 3 4 5 6 |
<!--<reference name="top.links">
<block type="checkout/links" name="checkout_cart_link">
<action method="addCartLink"></action>
<action method="addCheckoutLink"></action>
</block>
</reference>-->
|
To remove “Search Terms” and “Advanced Search” links, edit catalogsearch.xml and comment
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
<!--<reference name="footer_links">
<action method="addLink" translate="label title" module="catalogsearch"
ifconfig="catalog/seo/search_terms">
<label>Search Terms</label>
<url helper="catalogsearch/getSearchTermUrl" />
<title>Search Terms</title>
</action>
<action method="addLink" translate="label title" module="catalogsearch">
<label>Advanced Search</label>
<url helper="catalogsearch/getAdvancedSearchUrl" />
<title>Advanced Search</title>
</action>
</reference>-->
|
To remove “My Account” and “Log In/Log Out” links
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
<!--<reference name="top.links">
<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>-->
<!--<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>
</reference>-->
<!--<reference name="top.links">
<action method="addLink" translate="label title" module="customer">
<label>Log In</label>
<url helper="customer/getLoginUrl"/>
<title>Log In</title>
<prepare/><urlParams/>
<position>100</position>
</action>
</reference>-->
|
– Remove And Edit by Override all With local.xml :
Create the local.xml in thes the layout folder and play with him :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
<!--?xml version="1.0"?-->
<layout version="0.1.0">
<default>
<reference name="root">
<reference name="top.links">
<!-- Removes 'My Account' link - Default position: 10 -->
<action method="removeLinkByUrl"><url helper="customer/getAccountUrl"></url></action>
<remove name="wishlist_link">
<!-- Removes 'My Cart' AND 'Checkout' links -->
<remove name="checkout_cart_link">
<!-- To re-add 'My Cart' or 'Checkout' after removing both -->
<block type="checkout/links" name="checkout_cart_link_custom">
<action method="addCartLink"></action>
<action method="addCheckoutLink"></action>
</block>
</remove></remove></reference>
<reference name="footer_links">
<!-- Removes 'Search Terms' link -->
<action method="removeLinkByUrl">
<url helper="catalogsearch/getSearchTermUrl">
</url></action>
<!-- Removes 'Advanced Search' link -->
<action method="removeLinkByUrl">
<url helper="catalogsearch/getAdvancedSearchUrl">
</url></action>
</reference>
</reference>
</default>
<customer_logged_out>
<!-- Removes 'Log In' link - Default position: 60 -->
<reference name="top.links">
<action method="removeLinkByUrl"><url helper="customer/getLoginUrl"></url></action>
</reference>
</customer_logged_out>
<customer_logged_in>
<!-- Removes 'Log Out' link - Default position: 60 -->
<reference name="top.links">
<action method="removeLinkByUrl"><url helper="customer/getLogoutUrl"></url></action>
</reference>
</customer_logged_in>
</layout>
|