cancel
Showing results for 
Search instead for 
Did you mean: 

after updating to 1.8 or 1.9 repeating listing of first set of subcategories in menu

after updating to 1.8 or 1.9 repeating listing of first set of subcategories in menu

Hi,

 

I found, after updating from 1.7 to 1.8, that the code changed in app/code/core/Mage/Catalog/Block/Navigation.php

In 1.7 and 1.6 there was

 

 

public function getCurrentChildCategories() 
    {
        $layer = Mage::getSingleton('catalog/layer');
        $category   = $layer->getCurrentCategory();
        /* @var $category Mage_Catalog_Model_Category */
        $categories = $category->getChildrenCategories();
        $productCollection = Mage::getResourceModel('catalog/product_collection');
        $layer->prepareProductCollection($productCollection);
        $productCollection->addCountToCategories($categories);
        return $categories;
    }

Now with 1.8 there is

 

 

public function getCurrentChildCategories()
    {
        if (null === $this->_currentChildCategories) {
            $layer = Mage::getSingleton('catalog/layer');
            $category = $layer->getCurrentCategory();
            $this->_currentChildCategories = $category->getChildrenCategories();
            $productCollection = Mage::getResourceModel('catalog/product_collection');
            $layer->prepareProductCollection($productCollection);
            $productCollection->addCountToCategories($this->_currentChildCategories);
        }
        return $this->_currentChildCategories;
    }

 

This made it necessary to modify my code to null _currentChildCategories before calling the function.

 

 

<?php $this->_currentChildCategories = null;?>
<?php $_categories=$this->getCurrentChildCategories()?>