Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Category Menu
 
Alearr
Jr. Member
 
Avatar
Total Posts:  5
Joined:  2007-11-28
 

Hi everyone, I’m trying to understand the reason of this error:
Notice: Undefined variable: condition in {{main_path}}/app/code/core/Mage/Catalog/Model/Entity/Category/Collection.php on line 62

The method interested is addIdFilter($categoryIds)

public function addIdFilter($categoryIds)
    
{
        
if (is_array($categoryIds)) {
            $condition 
= array('in' => $categoryIds);
        
}
        
elseif (is_numeric($categoryIds)) {
            $condition 
$categoryIds;
        
}
        
elseif (is_string($categoryIds)) {
            $ids 
explode(','$categoryIds);
            if (empty(
$ids)) {
                $condition 
$categoryIds;
            
}
            
else {
                $condition 
= array('in' => $ids);
            
}
        }

        $this
->addFieldToFilter('entity_id'$condition);
        return 
$this;
    
}

I don’t know why it seems that $categoryIds is an empty array thus there are subcategories and products in it. This, only for certain categories.
Thanks for any help.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Alearr
Jr. Member
 
Avatar
Total Posts:  5
Joined:  2007-11-28
 

The complete exception:

[0] in Mage_Catalog_Model_Entity_Category_Collection->addIdFilter(NULL) in /var/www/ingegnoli/app/code/core/Mage/Catalog/Block/Navigation.php on line 79
[1] in Mage_Catalog_Block_Navigation->getCurrentChildCategories() in /var/www/ingegnoli/app/design/frontend/default/default/template/catalog/navigation/top.phtml on line 38
[2] in include("/var/www/ingegnoli/app/design/frontend/default/default/template/catalog/navigation/top.phtml") in /var/www/ingegnoli/app/code/core/Mage/Core/Block/Template.php on line 122
[3] in Mage_Core_Block_Template->fetchView("frontend/default/default/template/catalog/navigation/top.phtml") in /var/www/ingegnoli/app/code/core/Mage/Core/Block/Template.php on line 153
[4] in Mage_Core_Block_Template->renderView() in /var/www/ingegnoli/app/code/core/Mage/Core/Block/Template.php on line 198
[5] in Mage_Core_Block_Template->toHtml() in /var/www/ingegnoli/app/code/core/Mage/Core/Block/Text/List.php on line 36
[6] in Mage_Core_Block_Text_List->toHtml() in /var/www/ingegnoli/app/code/core/Mage/Core/Block/Abstract.php on line 426
[7] in Mage_Core_Block_Abstract->_getChildHtml("topMenu", 1) in /var/www/ingegnoli/app/code/core/Mage/Core/Block/Abstract.php on line 404
[8] in Mage_Core_Block_Abstract->getChildHtml("topMenu") in /var/www/ingegnoli/app/design/frontend/default/default/template/page/2columns-left.phtml on line 54
[9] in include("/var/www/ingegnoli/app/design/frontend/default/default/template/page/2columns-left.phtml") in /var/www/ingegnoli/app/code/core/Mage/Core/Block/Template.php on line 122
[10] in Mage_Core_Block_Template->fetchView("frontend/default/default/template/page/2columns-left.phtml") in /var/www/ingegnoli/app/code/core/Mage/Core/Block/Template.php on line 153
[11] in Mage_Core_Block_Template->renderView() in /var/www/ingegnoli/app/code/core/Mage/Core/Block/Template.php on line 198
[12] in Mage_Core_Block_Template->toHtml() in /var/www/ingegnoli/app/code/core/Mage/Core/Model/Layout.php on line 417
[13] in Mage_Core_Model_Layout->getOutput() in /var/www/ingegnoli/app/code/core/Mage/Core/Controller/Varien/Action.php on line 313
[14] in Mage_Core_Controller_Varien_Action->renderLayout() in /var/www/ingegnoli/app/code/core/Mage/Catalog/controllers/CategoryController.php on line 65
[15] in Mage_Catalog_CategoryController->viewAction() in /var/www/ingegnoli/app/code/core/Mage/Core/Controller/Varien/Action.php on line 336
[16] in Mage_Core_Controller_Varien_Action->dispatch("view") in /var/www/ingegnoli/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php on line 150
[17] in Mage_Core_Controller_Varien_Router_Standard->match(Mage_Core_Controller_Request_Http) in /var/www/ingegnoli/app/code/core/Mage/Core/Controller/Varien/Front.php on line 147
[18] in Mage_Core_Controller_Varien_Front->dispatch() in /var/www/ingegnoli/app/Mage.php on line 379
[19] in Mage::run("base") in /var/www/ingegnoli/index.php on line 29

 
Magento Community Magento Community
Magento Community
Magento Community
 
Alearr
Jr. Member
 
Avatar
Total Posts:  5
Joined:  2007-11-28
 

and finally, this is my top.phtml file:

<div class="header-nav-container">
    <
div class="header-nav-img">&nbsp;</div>
    <
div class="header-nav">
        <
h4 class="no-show"><?=$this->__('Category Navigation:')?></h4>
        <
ul id="nav">
        
<?
            
// Nextre: se sono all'interno di una categoria mostro il menu delle sottocategorie,
            // altrimenti mostro quello delle categorie generali del negozio
            
$cat Mage::registry('current_category');
            if (
$cat{
                $_categories
=$this->getCurrentChildCategories();
                if(
$_categories->count()) {
        ?>
            
<li class="selected"><?=$cat->getName()?></li>
        
<?
                    
foreach ($_categories as $_category{
                        
if($_category->getIsActive()) {
        ?>
            
<li>
                <
a href="<?=$this->getCategoryUrl($_category)?>"<?if ($this->isCategoryActive($_category)):?> class="active"<?endif?>><?=$_category->getName()?></a> (<?=$_category->getProductCount()?>)
            </
li>
        
<?
                        }
                    }
                }
            }
            
else {
                
foreach ($this->getStoreCategories() as $_category{
                    
echo $this->drawItem($_category);
                
}
            }
        ?>
        
</ul>
    </
div>
    <
div id="end_menu_catalogo">&nbsp;</div>



    
<?=$this->getChildHtml('topLeftLinks')?>




</div>
 
Magento Community Magento Community
Magento Community
Magento Community
 
Alearr
Jr. Member
 
Avatar
Total Posts:  5
Joined:  2007-11-28
 

I forgot to insert these attributes in my ‘catalog_category_entity_text’ table:
32-all_children
33-path_in_store
34-children

I’m importing an ms sql db into Magento. Hope is this auto-thread was useful rasberry

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