2

I m using magento 1.9.0.1 to remove cateogroy from frontend top menu for specific category for specific customer or customer group. I m using below code for testing but it not work

/frontend/default/YOURTHEMENAME/template/catalog/navigation/top.phtml

    <?php $_menu = ''?>
<?php foreach ($this->getStoreCategories() as $_category): ?>
    <?php $_menu .= $this->drawItem($_category) ?>
<?php endforeach ?>
<?php if ($_menu): ?>
<div class="nav-container">
    <ul id="nav">
    <?php foreach ($this->getStoreCategories() as $_category): ?>
    <?php if (!in_array($_category->getId(), array(12,34,56))) : ?> <?php echo $this->drawItem($_category) ?>
    <?php endif; ?>
    <?php endforeach ?>
    </ul>
</div>
<?php endif; ?>

any help would be greatly appreciate.

2
  • you can fetch the data using customer session and based on that you can show and hide the menu
    – Keyul Shah
    Commented Jan 7, 2015 at 9:30
  • i know that but i m creating one extenssion so it should be compatible to magento version so i mean which block override to customize top menu or any event for the same.
    – Zahirabbas
    Commented Jan 7, 2015 at 9:35

2 Answers 2

0

Freedom,you can get current customer group below code

Mage::getSingleton('customer/session')->getCustomerGroupId() from session you need put code

4
  • i know but which code block override for top menu customisatio or any event that i can listen and do whatever i need.
    – Zahirabbas
    Commented Jan 7, 2015 at 9:33
  • this phtml file is rebnder from Mage_Catalog_Block_Naviagtion class
    – Amit Bera
    Commented Jan 7, 2015 at 9:36
  • 1
    wait . i will give solution
    – Amit Bera
    Commented Jan 7, 2015 at 9:40
  • peploes downvote for you also, crazy guys..... Commented Jul 28, 2016 at 14:02
0
$customerId = Mage::getSingleton('customer/session')->getId() //to get customer id

$groupId = Mage::getSingleton('customer/session')->getCustomerGroupId(); //to get customer group id



<?php if (!in_array(customerId, array(10,20,30))) : ?> //the costumers id that you want to remove the category
      // Your category block
<?php endif;?>

The same thing for customer group

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.