Ok, so i'm trying to show a certain link in the customer account area only if a customer is a particular group.

I can get the link to show by:

    <reference name="customer_account_navigation" >    
        <action method="addLink" translate="label" module="mymodule"><name>module link</name><path>mymodule/account</path><label>Module Link</label></action>

But how could I apply a conditional statement to this to only get this to show based on a customer group?

My thoughts are:

public function accountAction()
    if (Mage::getSingleton('customer/session')->isLoggedIn() && Mage::getSingleton('customer/session')->getCustomerGroupId() == 3){
        // edit layout?

Is this the correct approach?

1 Answer 1


replace // edit layout? with

$navBlock = $this->getLayout()->getBlock('customer_account_navigation');
if ($navBlock) {
         Mage::helper('mymodule')->__('Module Link'),
         Mage::helper('mymodule')->__('Module Link')

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.