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.

Share:
Share on Facebook0Share on LinkedIn1Tweet about this on TwitterShare on Google+0Buffer this pageDigg thisShare on Reddit1

Leave a Reply

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

Most Popular Posts

Getting Started with CodeIgniter

Posted on 5 years ago

Bhumi

What are Lambdas and Closures in PHP?

Posted on 5 months ago

Bhumi

How to use SSL in WordPress

Posted on 4 years ago

Bhumi

Facade implementation in Laravel

Updated 3 weeks ago

Bhumi

MySQL coalesce() function

Updated 17 years ago

Bhumi

How to use JavaScript Promise API?

Updated 17 years ago

Bhumi

What are Lambdas and Closures in PHP?

Updated 17 years ago

Bhumi

The Reader’s Poll – June 2015

Posted on 2 years ago

Bhumi

The Reader’s Poll – August 2014

Posted on 3 years ago

Bhumi

The Reader’s Poll – June 2014

Posted on 3 years ago

Bhumi

The Readers’ Poll – May 2014

Posted on 3 years ago

Bhumi

The Readers’ Poll – August 2013

Posted on 4 years ago

Bhumi