Question

I think this is a quite common problem: There are normal products categories but also some additional CMS pages which could be included in the main shop navigation.

In some shops I have seen the solution, that content was put in a CMS block and the category switched to "display only CMS" block to resemble a navigation for the shop content.

But I do not think that this is a best practice.

Are there better workarounds in Community Edition? (I know there is a Enterprise Edition feature to do this).

Or is there a well-known open source module helping with that?

Was it helpful?

Solution

Starting with Magento CE 1.7 there is this event available page_block_html_topmenu_gethtml_before that allows you to add any items to the top menu.
For example it is used to add the categories to top menu in Mage_Catalog_Model_Observer::addCatalogToTopmenuItems().
The only constraint is that your top menu block should look like this in page.xml

<block type="core/text_list" name="top.menu" as="topMenu" translate="label">
    <label>Navigation Bar</label>
    <block type="page/html_topmenu" name="catalog.topnav" template="page/html/topmenu.phtml"/>
</block> 

If your theme is somehow similar with the default theme for 1.7 you should be able to add links to the top menu using this event.
Note: in 1.7 the top menu is rendered by this template: page/html/topmenu.phtml.

OTHER TIPS

There's definitely no built-in possibility to do this. Also I don't see any quick and pretty way to achieve this without writing a module.

The problem is to determine which of CMS pages have to be included into menu.

In addition to the solution you just described I can also suggest creating a static block consisting of <li> nodes and then injecting it into catalog/navigation/top.phtml template of your theme. This will give admin an opportunity to control what pages will be included into menu. No quite nice approach also if you ask me.

Another approach may be to add one or two (before and after categories) child blocks to catalog.topnav and also pulling them in catalog/navigation/top.phtml template. Then the CMS page can be added to menu with Custom Layout Update. Not nice approach either.

I would also like to know if there's an existing extension which automates it.

One of the way is to create normal category and rewrite it to related CMS page using Catalog > URL Rewrite Management section.
For more:
http://www.magentocommerce.com/knowledge-base/entry/adding-page-links-in-the-navigation-bar

An extension that we've used before is JR_CleverCMS. Unfortunately it's no longer available on GitHub, but it is avalable here, as CMS Tree.

It gives the ability to structure CMS pages in a hierarchical tree, and to display pages in the navigation menu.


You can use this extension which enable you to manage your full navigation including cms pages and other links directly from Magento categories. http://www.typoart.dk/en/magento-moduler/typoart-menu-cms-module.html

Disclaimer: I am working at the company selling this extension.

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top