Php 如何在Magento中显示导航菜单中未包含的类别
如何在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 $_
<?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()