1

I need to show the different options according to group of the customer in MY ACCOUNT section.

For example, I need to show only My profile, Account Information, social media accounts link in the MY ACCOUNT section of the customer dashboard. Some of links will be custom controller actions so how I can show these link and manage the session so that all this happened only when the customer is login.

3
  • you want to change navigation for the customer? Aug 30, 2016 at 12:06
  • yes want to show different links according to the group of the user. These links contains custom controller actions so I also need to manage the session on those pages. Aug 30, 2016 at 12:08
  • 1
    @QaisarSatti Can you please have a look at my question magento.stackexchange.com/questions/133806/… Aug 30, 2016 at 12:29

1 Answer 1

1

Step 1: Go To ( YourTemplate/customer/account/navigation.phtml )

Step 2: Replace This Line: <?php $_count = count($_links); ?>

<?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 */
?> 

if you want to do this in module then override

<customer_account>
   <reference name="customer_account_navigation">
      <action method="setTemplate"><template>modulename/customer/account/navigation.phtml</template></action>
    </reference>
</customer_account>

for checking the session

checing the session of user

if(!Mage::getSingleton('customer/session')->isLoggedIn()){
             $this->setFlag('', 'no-dispatch', true);

        $this->_redirect('customer/account');
        return ;
    }

getting the customer group

$customerData = Mage::getSingleton('customer/session')->getCustomer();
$customerData->getGroupId()
11
  • Thanks for the answer. Let me do this way. will get back to you. Thanks again. Aug 30, 2016 at 12:27
  • for Step 1 you mean this path: app/design/frontend/base/default/template/customer/account/navigation.phtml Aug 30, 2016 at 13:31
  • @muditmehrotra yes Aug 30, 2016 at 14:10
  • Now I know how to show/hide the navigation link according to the group but how to add a custom controller action as a link and open its content in the dashboard. For example, Controller action->Profile View->template/modulename/profile.phtml Now I need to add the profile as link in the navigation and show the profile.phtml contents inside the dashboard. Aug 31, 2016 at 7:25
  • for that you have rewrite the customer controller. Aug 31, 2016 at 7:30

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.