Create link on customer account BUT not last
-
16-10-2019 - |
Question
I am making a question because I couldn't find a way to overcome that.I have made a link in the Account Dashboard but it comes last. How can I put it first? I used before="-" but it doesn't change it.
> <customer_account>
> <reference name="customer_account_navigation" >
> <action method="addLink" >
> <name>trade</name>
> <path>tradedownloads/index/index</path>
> <label>Resources</label>
> </action>
> </reference>
> </customer_account>
>
> <tradedownloads_index_index>
> <update handle="customer_account" /> <reference name="my.account.wrapper" >
> <block type="core/template" name="tradedownloads" before="-" template="tradedownloads/left.phtml"></block>
> </reference>
> </tradedownloads_index_index>
That's the xml file i use.
Solution
It is not possible to do with standard Magento functionality.
You need to rewrite block Mage_Customer_Block_Account_Navigation
methods addLink($name, $path, $label, $urlParams=array())
and getLinks()
. Add parameter $order
to addLink
method. And do sorting by order in getLinks
.
If you will do that in your xml file you can do something like this
<action method="addLink">
<name>trade</name>
<path>tradedownloads/index/index</path>
<label>Resources</label>
<urlParams></urlParams>
<order>1</order>
</action>
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange