Show sub category instead of Root in Menu

2019-09-06 16:50发布

问题:

before domain transfer My menu looked like

I cant understand what happened during the domain transfer and now menu looks like

My Category structure is

I am trying to restore the menu as it was before domain transfer, I have tried all the options on my previous question on SO but yet no success...

Trying to figure it out for almost a week, but Can't..

any idea? any guideline? how can I restore the menu as it was before domain transfer??

回答1:

In the backend, go to Catalog->Manage Categories, then click on your root category ("Categories"). On the bottom there is a field "Include in Navigation Menu". Set that to "No" and reindex. Then look whether your problem is solved.



回答2:

I was working on this problem over a week, and finally I got the solution..

Infact, it was a guideline from SO question, located here

I edited the file

app/design/frontend/default/YOU_TEMPLATE/template/catalog/navigation/top.phtml

and my new code is

<?php $_menu = ''?>
<?php
$children = Mage::getModel('catalog/category')->getCategories(2);

?>
<?php foreach ($children as $_category): ?>
    <?php $_menu .= $this->drawItem($_category) ?>
<?php endforeach ?>
<?php if ($_menu): ?>
        <?php echo $_menu; ?>
<?php endif; ?>

to get the sub catgories of a specific root categories, you can do it like

$children = Mage::getModel('catalog/category')->getCategories(2);

For someone having trouble like me, it might help well..

thanks to all