1

enter image description here

I'd like to hide several menu on MY Account page to my customers. So I tried to change navigation.phtml file, but I couldn't find the menu on MY Accout page.

The file was written like this

<div class="block-content">
    <ul>
        <?php $_links = $this->getLinks(); ?>
        <?php $_index = 1; ?>
        <?php $_count = count($_links); ?>
        <?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>

I think I have to change other file instead of navigation.phtml

Where the file having an effect on this menu?

3 Answers 3

0

All menu for account section are defined in layout xml's under reference name="customer_account_navigation".

Some example are :

Billing Agreements : copy this file app/design/frontend/base/default/layout/sales/billing_agreement.xml in your current theme and remove below lines

<reference name="customer_account_navigation" >
    <action method="addLink" translate="label"><name>billing_agreements</name><path>sales/billing_agreement/</path><label>Billing Agreements</label></action>
</reference>

Recurring Profiles : copy this file app/design/frontend/base/default/layout/sales/recurring_profile.xml in your current theme and remove below lines

<reference name="customer_account_navigation" >
        <action method="addLink" translate="label"><name>recurring_profiles</name><path>sales/recurring_profile/</path><label>Recurring Profiles</label></action>
    </reference>

My Downloadable Products : copy this file app/design/frontend/base/default/layout/downloadable.xml in your current theme and remove below lines

<reference name="customer_account_navigation">
        <action method="addLink" translate="label" module="downloadable"><name>downloadable_products</name><path>downloadable/customer/products</path><label>My Downloadable Products</label></action>
    </reference>
0
0

In your theme local.xml add below code with this code first remove your navigation and then add links that you want to display :

<customer_account translate="label">
    <reference name="left">
        <!--Unset the whole block then add back later-->
        <action method="unsetChild"><name>customer_account_navigation</name></action>
        <block type="customer/account_navigation" name="customer_account_navigation" before="-" template="customer/account/navigation.phtml">
            <action method="addLink" translate="label" module="customer"><name>account</name><path>customer/account/</path><label>Account Dashboard</label></action>
            <action method="addLink" translate="label" module="customer"><name>account_edit</name><path>customer/account/edit/</path><label>Account Information</label></action>
            <action method="addLink" translate="label" module="customer"><name>address_book</name><path>customer/address/</path><label>Address Book</label></action>
            <action method="addLink" translate="label" module="sales"><name>orders</name><path>sales/order/history/</path><label>My Orders</label></action>
            <action method="addLink" translate="label" module="review"><name>reviews</name><path>review/customer</path><label>My Product Reviews</label></action>
            <action method="addLink" translate="label" module="wishlist" ifconfig="wishlist/general/active"><name>wishlist</name><path>wishlist/</path><label>My Favorite</label></action>
            <action method="addLink" translate="label" module="newsletter"><name>newsletter</name><path>newsletter/manage/</path><label>Newsletter Subscriptions</label></action>
        </block>
        <remove name="catalog.compare.sidebar"/>
    </reference>
</customer_account>
0

First you need to override navigation file, so add this code in config xml:

<customer>
  <rewrite>
       <account_navigation>Mynamespace_Mymodule_Block_Account_Navigation</account_navigation>
  </rewrite>
</customer>

Then create Folder Mynamespace/Mymodule/Block/Account /Navigation.php and add below code:

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

Open xml file in layout folder than add below code:

<customer_account translate="label">
    <reference name="customer_account_navigation">
        <action method="removeLinkByName"><name>billing_agreements</name></action>
        <action method="removeLinkByName"><name>recurring_profiles</name></action>
        <action method="removeLinkByName"><name>tags</name></action>
        <action method="removeLinkByName"><name>wishlist</name></action>
        <action method="removeLinkByName"><name>OAuth Customer Tokens</name></action>
        <action method="removeLinkByName"><name>downloadable_products</name></action>
    </reference>
</customer_account>
1

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.