【发布时间】:2015-09-22 06:57:57
【问题描述】:
我通过目录菜单添加了新类别。但它没有在前端显示类别。
1.类别在默认类别下。
2.是否活跃 - 是
这些是我对新类别所做的设置。保存后,当我转到前端时,它不显示类别。如何让添加到该分类下的产品出现在前端。
生成的类别 id 为 72 表明存在问题。下面提供的是我在 .phtml 文件中使用的代码,用于显示类别 id(72) 的产品。除了类别 id 72(它是新创建的)之外,其余所有其他类别产品都可以通过传递类别 id 来检索。
<?php
$categoryId = 72;
//here $categoryId is the id of the category
$category = Mage::getModel('catalog/category')->load($categoryId);
$collection = $category->getProductCollection();
$collection->addCategoryFilter($category); //category filter
$collection->addAttributeToFilter('status',1); //only enabled product
$collection->addAttributeToSelect('*');
?>
请帮我解决这个问题
【问题讨论】: