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

Sub Categories Error
 
Dorgo
Sr. Member
 
Total Posts:  127
Joined:  2008-12-16
 

Upgraded to 1.3.0 recently.

When i click on a category in my vertical navigation that has sub categories i get the following error. (i did not get this before the upgrade)

WarningInvalid argument supplied for foreach()  in /myHomeDir/public_html/app/design/frontend/default/MyView/template/catalog/navigation/vert_nav.phtml on line 13
Trace
:
#0 /myHomeDir/public_html/app/design/frontend/default/MyView/template/catalog/navigation/vert_nav.phtml(13): mageCoreErrorHandler(2, 'Invalid argumen...', '/myHomeDir/...', 13, Array)
#1 /myHomeDir/public_html/app/code/core/Mage/Core/Block/Template.php(144): include('/myHomeDir/...')
#2 /myHomeDir/public_html/app/code/core/Mage/Core/Block/Template.php(176): Mage_Core_Block_Template->fetchView('frontend/defaul...')
#3 /myHomeDir/public_html/app/code/core/Mage/Core/Block/Template.php(193): Mage_Core_Block_Template->renderView()
#4 /myHomeDir/public_html/app/code/core/Mage/Core/Block/Abstract.php(643): Mage_Core_Block_Template->_toHtml()
#5 /myHomeDir/public_html/app/code/core/Mage/Core/Block/Text/List.php(43): Mage_Core_Block_Abstract->toHtml()
#6 /myHomeDir/public_html/app/code/core/Mage/Core/Block/Abstract.php(643): Mage_Core_Block_Text_List->_toHtml()
#7 /myHomeDir/public_html/app/code/core/Mage/Core/Block/Abstract.php(503): Mage_Core_Block_Abstract->toHtml()
#8 /myHomeDir/public_html/app/code/core/Mage/Core/Block/Abstract.php(454): Mage_Core_Block_Abstract->_getChildHtml('left', true)
#9 /myHomeDir/public_html/app/design/frontend/default/MyView/template/page/3columns.phtml(55): Mage_Core_Block_Abstract->getChildHtml('left')
#10 /myHomeDir/public_html/app/code/core/Mage/Core/Block/Template.php(144): include('/myHomeDir/...')
#11 /myHomeDir/public_html/app/code/core/Mage/Core/Block/Template.php(176): Mage_Core_Block_Template->fetchView('frontend/defaul...')
#12 /myHomeDir/public_html/app/code/core/Mage/Core/Block/Template.php(193): Mage_Core_Block_Template->renderView()
#13 /myHomeDir/public_html/app/code/core/Mage/Core/Block/Abstract.php(643): Mage_Core_Block_Template->_toHtml()
#14 /myHomeDir/public_html/app/code/core/Mage/Core/Model/Layout.php(526): Mage_Core_Block_Abstract->toHtml()
#15 /myHomeDir/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(339): Mage_Core_Model_Layout->getOutput()
#16 /myHomeDir/public_html/app/code/core/Mage/Catalog/controllers/CategoryController.php(103): Mage_Core_Controller_Varien_Action->renderLayout()
#17 /myHomeDir/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(367): Mage_Catalog_CategoryController->viewAction()
#18 /myHomeDir/public_html/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(247): Mage_Core_Controller_Varien_Action->dispatch('view')
#19 /myHomeDir/public_html/app/code/core/Mage/Core/Controller/Varien/Front.php(158): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#20 /myHomeDir/public_html/app/Mage.php(457): Mage_Core_Controller_Varien_Front->dispatch()
#21 /myHomeDir/public_html/index.php(52): Mage::run()
#22 {main}

The code in /myHomeDir/public_html/app/design/frontend/default/MyView/template/catalog/navigation/vert_nav.phtml is

<div class="vertical-nav-container box ">
    <
div id="vertical-nav">
        <
div class="head">
            <
h3><?php echo $this->__('Categories'?></h3>
        </
div>
        <
ul id="nav_vert">
            
<?php foreach ($this->getStoreCategories() as $_category): ?>
            <?php $open 
$this->isCategoryActive($_category); ?>
            <?php $potential 
$_category->hasChildren(); ?>
            
<li><a href="<?php echo $this->getCategoryUrl($_category); ?>"<?php if($openecho ' class="open"'} ?><?php if($potentialecho ' class="potential"'} ?> ><?php echo $_category->getName();?> <?php if($potential&&$openecho 'v 'elseif($potentialecho '> '}else{ echo '  '}?></a>
                
<?php if ($open && $potential): ?>
                
<ul>
                    
<?php foreach ($_category->getChildren() as $subcategory): ?>
                    <?php $subCat 
Mage::getModel('catalog/category')->load($subcategory); ?>
                    <?php $open 
$this->isCategoryActive($subCat); ?>
                    <?php $potential 
$subCat->hasChildren(); ?>
                    
<li><a href="<?php echo $this->getCategoryUrl($subCat); ?>"<?php if($openecho ' class="subopen"'} ?><?php if($potentialecho ' class="potential"'} ?><?php if(!$potential&&$openecho ' class="final"'} ?> ><?php echo $subCat->getName(); ?> <?php if($potential&&$openecho 'v 'elseif($potentialecho '> '}?></a>
                        
<?php if ($open && $potential): ?>
                        
<ul>
                            
<?php foreach ($subcategory->getChildren() as $subsubcategory): ?>
                            <?php $subsubCat 
Mage::getModel('catalog/category')->load($subsubcategory); ?>
                            <?php $open 
$this->isCategoryActive($subsubCat?>
                            
<li><a href="<?php echo $this->getCategoryUrl($subsubCat); ?>" <?php if($openecho ' class="final"'} ?>><?php echo $subsubCat->getName(); ?></a></li>
                            
<?php endforeach; ?>
                        
</ul>
                        
<?php endif; ?>
                    
</li>
                    
<?php endforeach; ?>
                
</ul>
                
<?php endif; ?>
            
</li>
            
<?php endforeach ?>
        
</ul>
    </
div>
</
div>

anyone have any ideas what changed so that

<?php foreach ($_category->getChildren() as $subcategory): ?>
no longer works?
 
Magento Community Magento Community
Magento Community
Magento Community
 
Dorgo
Sr. Member
 
Total Posts:  127
Joined:  2008-12-16
 

anyone? hmmm

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