Case Study: How To Simply Add A Static Page To The Navigation Menu in Magento
Magento is a perfect solution for E-commerce. There are plenty of features included to meet any requirements and needs of sellers. However, there is a problem when displaying common static pages, such as the About Us and Contact pages, which is called CMS pages in Magento.
There is an option to edit and add them in the Admin panel, but when a user needed to display links on the main navigation bar, there was a problem.
It was impossible to accomplish without code customization, which required a great deal of time and effort. Given how frequently we were asked about this type of development, we decided to create an extension to simplify the process.
The solution we found is based on using a catalogue categories menu, which allows one to render CMS page links and titles instead of category link and category name. To ensure user-friendly management, we reached a solution of adding a new tab to the CMS page edit section following the Meta Data tab. Our custom tab contains a categories tree, like on a product edit page in categories tab, so we can assign a CMS page by clicking checkboxes on the tree nodes. We had to completely rewrite the cms/page model and implement our custom “after save and before delete” logic.
At first sight, it would seem that all we need is to create a reference to cms_page_edit_tabs block and insert our categories tree inside. However, tabs in the product edit page and cms page edit page are different. We could not use the adminhtml/catalog_product_edit_tab_categories block as a tab in the CMS page edit, because it requires that the tab block calls the Mage_Adminhtml_Block_Widget_Tab_Interface interface, but the catalogue categories tree doesn’t implement this interface. Therefore, we created a custom adminhtml block and extended the categories tree block. Then, we overrode the methods specific for categories tree view.
We’ve spent about 80 hours on development, but now it will only take a few minutes to install the extension. It creates a new tab in the edit section, where an Admin can simply assign a CMS page to a selected category without using any URL rewrite management or redirects. Moreover, this extension supports multiple stores, which is quite important due to its growing popularity.
If this is something you were looking for, please visit the Itera Research account on Magento Connect
Sincerely,
Itera Research team