0

I was struggling to sorting the customer account navigation link out of the box.But was unable to find out proper solution to rearrange this navigation.

So i google and get some idea to make it possible.

I got some idea from the suggestion of @marius from this Link

1 Answer 1

1

Here is solution about above question.

Overwrite the Navigation.php File in your local folder and write the below code in it.

class Namespace_Modulename_Block_Customer_Account_Navigation extends 

Mage_Customer_Block_Account_Navigation
{

public function getLinksByName($name)
{
return $this->_links[$name];
}

}

Now overwrite or make theme file change at template/customer/account/navigation.phtml

    <div class="block block-account">

<div class="block-title">
<strong><span><?php echo $this->__('My Account'); ?></span></strong>
</div>


<div class="block-content">
<?php $_linkOrder = array('account', 'savecart', 'carpenterorder', 'warranty', 'supportticket','reports','account_edit','address_book','minicarpenter'); ?>

<ul>
<?php $_links = $this->getLinks(); ?>
<?php $_index = 1; ?>
<?php $_count = count($_links); ?>
<?php foreach ($_linkOrder as $linkName): ?>
<?php $OrderLinkobject = $this->getLinksByName($linkName); ?>
<?php if ($this->isActive($OrderLinkobject)): ?>

<li class="current<?php echo ($_last ? ' last' : '') ?>"><strong><?php echo $OrderLinkobject->getLabel() ?></strong></li>

<?php else: ?>
<li<?php echo ($_last ? ' class="last"' : '') ?>><a href="<?php echo $OrderLinkobject->getUrl() ?>"><?php echo $OrderLinkobject->getLabel() ?></a></li>

<?php endif; ?>
<?php unset($_links[$linkName]) ?>
<?php endforeach; ?>
<?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>

</div>

</div>

Here $_linkOrder = array('account', 'savecart', 'carpenterorder', 'warranty', 'supportticket','reports','account_edit','address_book','minicarpenter');

is my sorting order for specific link order rest will render by magento core.You can define name of your link in that array to sort.

Your Answer

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

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