Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/242.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/58.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何在Magento中显示导航菜单中未包含的类别_Php_Mysql_Magento_Filter_Categories - Fatal编程技术网

Php 如何在Magento中显示导航菜单中未包含的类别

Php 如何在Magento中显示导航菜单中未包含的类别,php,mysql,magento,filter,categories,Php,Mysql,Magento,Filter,Categories,如何在Magento中显示导航菜单中未包含的类别 <?php $_subcategories = $_category->getChildrenCategories(); ?> <li> <a <?php if (count($_subcategories) > 0){ ?> href='#' <?php }else { ?> href="<?php echo $_

如何在Magento中显示导航菜单中未包含的类别

<?php $_subcategories = $_category->getChildrenCategories(); ?>
    <li>
      <a <?php if (count($_subcategories) > 0){ ?>
      href='#' 
      <?php }else {  ?>
      href="<?php echo $_helper->getCategoryUrl($_category)?>"    

      <?php }?>

     <?php echo $_category->getName() ?></a>

    </li>

<?php } ?>


  • 在类别集合中,您必须检查它是否包含在导航菜单中

    if (!$_category->getIncludeInMenu()) {
        // your code here
    }
    
    下面是让它工作的代码-

    foreach($_subcategories->getData() as $category) {
        $subcatid = $category['entity_id'];
        $_cat = Mage::getModel('catalog/category')->load($subcatid);
        if (!$_cat->getIncludeInMenu()) {
            echo $_cat->getName();
        }
    }
    

    在类别集合中,您必须检查它是否包含在导航菜单中

    if (!$_category->getIncludeInMenu()) {
        // your code here
    }
    
    下面是让它工作的代码-

    foreach($_subcategories->getData() as $category) {
        $subcatid = $category['entity_id'];
        $_cat = Mage::getModel('catalog/category')->load($subcatid);
        if (!$_cat->getIncludeInMenu()) {
            echo $_cat->getName();
        }
    }
    

    让我添加一个过滤器以获取特定父类别中的类别<代码>->addAttributeToFilter('parent_id',数组('eq'=>$parentId))让我添加一个过滤器以获取特定父类别中的类别<代码>->addAttributeToFilter('parent_id',数组('eq'=>$parentId))我得到:调用未定义的方法Varien\u Data\u Tree\u Node\u Collection::getData()我得到:调用未定义的方法Varien\u Data\u Tree\u Node\u Collection::getData()