Back to Top

How to add CMS page to Main Navigation in Magento?

to add CMS page to Main Navigation in Magento

You already heard of Magento if worked in e-commerce application development. Magento is currently one of the most difficult PHP based e-commerce systems where a developer could learn and master. Here, I am going to explain about how you can add cms page navigation in Magento.

What are CMS pages in Magento?

CMS pages are the section available in Magento admin area to manage your web site pages. You can refer to your Magento Admin panel > CMS > pages menu from the top navigation in the admin panel.You can setup your static content like about us, contact page, story page etc from CMS pages. Once you create CMS pages, you want to display your CMS page to the frontend of Magento.

In this tutorial, You will know how you can display your CMS page in frontend and create a link in top navigation menu through the steps to perform some changes in your Magento.

Let’s get started:

Magento creates a navigation menu by default which is driven entirely through the catalogue. Generally, you need to include other static items within the main navigation menu based on your application.

The way I will teach you is very simple. First of all open app/design/rwd/default/template/page/html/topmenu.phtml and you need to add the line of code over there

Here is the code to add any hardcode URL in the file:

But this is not the correct way to modify hard code URL in the file. This might create an issue while upgrading Magento version.Also, It is totally out of Admin area and manageable from the file so it is difficult for your client who is a nontechnical person to understand if any change requires in future. so, In above case, it is mandatory to change domain when move site to live URL, instead of using static external URL you can alter the top.phtml file to load in a static block.

Basically, you need to add two static blocks with the identifiers nav-links-before and nav-links-after and in each of these blocks, you can add links to your CMS pages.with this way, you can add CMS pages but you can only add links left or right side of your main menu.

Add the following line of code into your app/design/rwd/default/template/page/html/topmenu.phtml file which will add the two new static blocks

Also, open your static block and add the following line of code to generate new Menu

Conclusion

With this post, I tried to demystify some of the strange changes you sometimes may experience. I hope by reading this and applying the concept you can avoid some frustration in the future. Following the best practices will get you a long way, and remember: its trick which Magento doesn’t provide. Hope you like the article about cms page navigation in magento and please share with your friends on social media.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Most Popular Posts

Getting Started with CodeIgniter

Posted on 12 years ago

Bhumi

PHP 7 new Features at a Glance

Posted on 9 years ago

Bhumi