Monday 1 September 2014

active class on custom menu in magento

<?php $main_cat = explode('index.php',$this->helper('core/url')->getCurrentUrl());
                 $mn_cat = explode('/',substr($main_cat[1],0,-5));
                 ?>
               
                <?php $_subcategories = $_category->getChildrenCategories() ?>
    <li class="<?php if(in_array(str_replace(' ','-',strtolower($_category->getName())),$mn_cat)){ echo "active";}?>"  ><span><a href="<?php echo $_helper->getCategoryUrl($_category) ?>">    

1 comment: