I create a top link, but i want it show if customer login has groupId = 2. Currently, if the group id is different from 2, it will still display <li> </li> but not My Text. How to fix it, please help me

block file:

public function __construct() {
    if(Mage::getSingleton('customer/session')->isLoggedIn()) {
        $customerData = Mage::getSingleton('customer/session')->getCustomer();
        if ($customerData->getGroupId() == 2) {
            $text = $this->__('My Text');
            $this->_label = $text;
            $this->_title = $text;
            $this->_url = $this->getUrl('url');

layout xml file:

    <reference name="top.links">
        <block type="custom/links" name="custom_link"/>
        <action method="addLinkBlock" ifconfig="custom/main/display_credit_link_in_top_menu"><blockName>custom_link</blockName><liParams>class='mini-top-cart'</liParams></action>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.