3

I manage to remove the items that I don't want from the Customer Account Dashboard Links, following this answer,

   <ul>
        <?php $_links = $this->getLinks(); ?>
        <?php $_index = 1; ?>
        <?php $_count = count($_links); /* Add or Remove Account Left Navigation Links Here -*/
            //unset($_links['account']); /* Account Info */     
            //unset($_links['account_edit']); /* Account Info */            
            unset($_links['tags']); /* My Tags */
            unset($_links['invitations']); /* My Invitations */
            //unset($_links['reviews']);  /* Reviews */
            //unset($_links['wishlist']); /* Wishlist */
            //unset($_links['newsletter']); /* Newsletter */
            //unset($_links['orders']); /* My Orders */
            unset($_links['address_book']); /* Address */
            unset($_links['enterprise_customerbalance']); /* Store Credit */
            unset($_links['OAuth Customer Tokens']); /* My Applications */
            unset($_links['enterprise_reward']); /* Reward Points */
            unset($_links['giftregistry']); /* Gift Registry */
            unset($_links['downloadable_products']); /* My Downloadable Products */
            unset($_links['recurring_profiles']); /* Recurring Profiles */
            //unset($_links['billing_agreements']); /* Billing Agreements */
            unset($_links['enterprise_giftcardaccount']); /* Gift Card Link */
        ?>
        <?php foreach ($_links as $_link): ?>
            <?php $_last = ($_index++ >= $_count); ?>
            <?php if ($this->isActive($_link)): ?>
                <li class="current<?php echo ($_last ? ' last' : '') ?>"><strong><?php echo $_link->getLabel() ?></strong></li>
            <?php else: ?>
                <li<?php echo ($_last ? ' class="last"' : '') ?>><a href="<?php echo $_link->getUrl() ?>"><?php echo $_link->getLabel() ?></a></li>
            <?php endif; ?>
        <?php endforeach; ?>
    </ul>

But, what about - if I want to change the order and the default name of them? For instance, I want to change them from,

Account Dashboard
Account Information
My Orders
Billing Agreements
My Product Reviews
My Wishlist
Newsletter Subscriptions
My Gift Cards

to,

My Dashboard
Account Information
Billing Agreements
My Orders
My Reviews
My Wishlist
My Gift Cards
Subscriptions

is it possible?

1
  • 1
    Firstly removing the items directly in the template is not the best idea as any change of theme or template update will cause this change to be lost. I suggest doing this via an extension or through layout xml changes Commented Feb 28, 2015 at 19:27

1 Answer 1

1

I see that you have a few options all of which have their plus and negative sides:

  1. Remove all the links via layout xml and then add them in the order you want,
  2. Extend the navigation block to add a setting of order function,
  3. Extend the navigation block to add a single function that will make sure the links are ordered correctly,

From my thinking the "best" option would be number 3. What you could do is rewrite the block and add a function sortNavigationItems. Then this function could read from your modules config.xml or a system.xml field to get the correct order of items.

The "simplest" option would be to take Marius' answer and remove all the menu items and then add the ones you need in the right order.

The reason that they get added in that order is because that is the order that the layout xml is loaded. So if you move the addition into your own modules xml file then they will be added in the correct order.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.