Magento Forum

   
getCurrentCategory() not working properly? 
 
rzazueta
Member
 
Total Posts:  34
Joined:  2008-07-21
 

I really need some help here and I’m hoping one of the Magento team folks are paying attention to the forums.

I have a store setup with three levels of categories. On each level, I want the left hand navbar to only display the current category and its children - nothing else.

Here’s how my menu structure is set up:

Default Category-
   
Browse by Brand -
        
O'Neill
        Vans
        etc.
    Browse by Category -
        Men'
s apparel
        Women
's apparel
        Sporting goods
        etc.

In my code for the left menu, I do the following:

<?php
    $_curr_category 
$this->getCurrentCategory();    
?>
<h2>Browse <?php echo($_curr_category->getName()); ?></h2>
<?php //$_categories=$this->getCurrentChildCategories() ?>
<?php //$_categories=$this->getChildCategories($_curr_category->getId()); ?>
<?php $_categories=$this->getCurrentChildCategories(); ?>
//Do a foreach and loop over the categories...

When I go to, say, “Default Category -> Browse by Brand -> Vans” $_curr_category->getName() is returning “Browse by Category” and $_cur_category->getCurrentChildCategories() is returning all of the items under “Browse by Category”. It *should* be returning “Vans” for $_curr_category->getName(); and should, at this point, be returning an empty array for the getCurrentChildCategories() call. So why is this not working? How do I fix this? Am I doing it wrong?

Thanks!

Rob Z.

 
Magento Community Magento Community
Magento Community
Magento Community
 
rzazueta
Member
 
Total Posts:  34
Joined:  2008-07-21
 

I’m bumping this. Is this a bug or am I just doing it wrong?

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
    Back to top