在菜单中显示子类别而不是根 [英] Show sub category instead of Root in Menu
问题描述
我的菜单看起来像
我不明白域名转移过程中发生了什么,现在菜单看起来像
< img src =https://i.stack.imgur.com/p8PVh.pngalt =enter image description here>
我的类别结构是
我正在尝试恢复菜单,就像域名转移一样,我已经尝试过我在上一个问题上的所有选项,在 SO ,但没有成功...
试图找出它出来差不多一个星期,但不能.. .. / b>
任何想法?任何指引?如何在域名转移之前恢复菜单?
我在一个星期内正在处理这个问题,最后我得到了解决方案。
我编辑了一个文件
app / design / frontend / default / YOU_TEMPLATE / template / catalog / navigation / top.phtml
/ pre>
,我的新代码是
<?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; ?>
要获取特定根类别的子类别,可以像
$ children = Mage :: getModel('catalog / category') - > getCategories(2);
对于有麻烦的人,我可能会有所帮助。
感谢所有
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??
解决方案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
这篇关于在菜单中显示子类别而不是根的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!