Create link on customer account BUT not last

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.

Solutions

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>

Similar questions

get customer who have not placed order from last 3 months but in optimized way
I need to optimized my answer. This gives me right output but I need it optimized way because I m working with large database
removing first and last name on customer/account
I need to figure out how to remove displaying the customers first and last name on the customer/account page. I have figured out how to do this with the checkout process already.
502 when customer signed in but not in customer account section
Using Redis and Cm_RedisSession module to store sessions, I'm seeing a 502 Bad Gateway error when a customer is signed in (but not when they are in the customer account section). The php error was not useful, but the issue seems to be the Redis connection timing out, I added a php-fpm slowfile to trigger after 10s: And then upped the logging for Re...
Magento 2: Custom Customer Attributes Showing in Customer Grid but Not Admin Account
I'm currently on Magento 2.2.6 and I created a multiple select attribute as well as a yes/no attribute for customers in the admin page, however I'm not seeing them show up and not sure where I went wrong. ../Vendor/Module/etc/module.xml Next I have my Setup/InstallData.php which calls my Setup/CustomerSetup.php file InstallData.php CustomerSetup.ph...
Create link dynamically in customer account navigation
I want to create a link dynamically in customer_block_account_navigation (link supposed to show up in the sidebar) A static link isn't a problem, you can achieve that with a xml layout update: The link goes to a custom form which supposed to show up only for certain customer. So I need to control the link (or layout update) via PHP in my own module...
Create link dynamically in customer account navigation in Magento 2
Hi i have created account navigation link, and i have two customer groups in magento admin panel, and i only want to display that links to specific group rather than displaying all the time. here is my xml code for displaying links. please suggest a way for this.

Also ask

We use cookies to deliver the best possible experience on our website. By continuing to use this site, accepting or closing this box, you consent to our use of cookies. To learn more, visit our privacy policy.