$collection = Mage::getModel('catalog/category')->getCollection()
->addAttributeToFilter('level',array('eq'=>2))
->addAttributeToFilter('is_active',array('eq'=>1))
->addAttributeToSelect('name')
->addAttributeToSelect('entity_id')
->addAttributeToSelect('url_path');
虽然打印$ collection我没有得到路径
答案 0 :(得分:0)
我认为你需要这个。仔细阅读这个
$_categories = Mage::getModel('catalog/category')->getCollection()
->addAttributeToSelect('name')
->addAttributeToSelect('is_active')
->addUrlRewriteToResult();
<?php foreach($_categories as $_category): ?>
<a href="<?php echo $_category->getUrl($_category); ?>">
<?php endforeach; ?>