I have a menu similar to Prada's where by users click for the menu and it drops down:
www.prada.com
I am looking to make information for certain categories appear in the header drop-down too. I.e. they click on 'collection' and a short paragraph fits into the menu to the right (almost like a sub-category).
UPDATE:
I also added this to 'renderer.phtml':
$html .= '<ul class="level' . $childLevel . '">';
$html .= $this->_getHtml($child, $childrenWrapClass);
$staticBlock = trim($this->getLayout()->createBlock('cms/block')->setBlockId($child->getId())->to Html());
if(!empty($staticBlock)){
$html .= '<span class="nav-static-block" style="background:#fff; border-top:1px solid #ccc; padding:10px;">';
$html .= $staticBlock;
$html .= '</span>';
}
$html .= '</ul>';
So it now looks like this:
$html = '';
$children = $menuTree->getChildren();
$parentLevel = $menuTree->getLevel();
$childLevel = is_null($parentLevel) ? 0 : $parentLevel + 1;
$counter = 1;
$childrenCount = $children->count();
$parentPositionClass = $menuTree->getPositionClass();
$itemPositionClassPrefix = $parentPositionClass ? $parentPositionClass . '-' : 'nav-';
foreach ($children as $child) {
$child->setLevel($childLevel);
$child->setIsFirst($counter == 1);
$child->setIsLast($counter == $childrenCount);
$child->setPositionClass($itemPositionClassPrefix . $counter);
$outermostClassCode = 'level'. $childLevel;
$_hasChildren = ($child->hasChildren()) ? 'has-children' : '';
$html .= '<li '. $this->_getRenderedMenuItemAttributes($child) .'>';
$html .= '<a href="'. $child->getUrl() .'" class="'. $outermostClassCode .' '. $_hasChildren .'">'. $this->escapeHtml($this->__($child->getName())) .'</a>';
if (!empty($childrenWrapClass)) {
$html .= '<div class="'. $childrenWrapClass .'">';
}
$html .= '<ul class="level' . $childLevel . '">';
$staticBlock = trim($this->getLayout()->createBlock('cms/block')->setBlockId($child->getId())->toHtml());
if(!empty($staticBlock)){
$html .= '<span class="nav-static-block" style="background:#000; border-top:1px solid #ccc; padding:10px;">';
$html .= $staticBlock;
$html .= '</span>';
}
$html .= '</ul>';
$nextChildLevel = $childLevel + 1;
if (!empty($_hasChildren)) {
$html .= '<ul class="level'. $childLevel .'">';
$html .= $this->render($child, $childrenWrapClass);
$html .= '</ul>';
}
if (!empty($childrenWrapClass)) {
$html .= '</div>';
}
$html .= '</li>';
$counter++;
}
return $html;
It works perfectly and is calling everything perfectly!
Best Answer
You can roll your own or you can use Pronav that can do that and more. Visit the demo store to see it's possibilities.
We have very good experiences with several customers using this extension.
The "roll your own" version, aka magento topmenu-101:
Mage::getModel('catalog/category)->load($id)
for each menu item ( why not? - how to fix - slide 10 )base/default/layout
orrwd/default/layout
). This means the easiest way to add something to the menu is to add another block to that text list, provided that this works with the generated HTML.Mage_Page_Block_Html_Topmenu_Renderer
if needed and override the block type in a layout XML file.skin/rwd/default/css/styles.css
shows various class-based selectors with the keyword 'hide' and 'hidden' that aid in hiding an item by default.js/lib/dropdown.js
for inspiration.Hopefully this helps you get started and feel free to ask specific questions if you get stuck.