Put CMS pages in Header Menu in Magento
Hi Friends !! After long time, I am back in blogging and posting some interesting stuffs for you.
Today I will show you that how you can change your header menu in magento and how you can put CMS pages in header dynamic menu.
In one of my project, I have faced the problem that how to change mail menu and how to put CMS pages in main menu.
After long search in google, i found the solution which I want to share with you. If you want to change you header in Magento, Please follow below steps :
First open top.phtml file of your template. My path for this file is /public_html/app/design/frontend/default/hellostyle/template/catalog/navigation/top.phtml.
Now after this, Remove default menu code like this :
<?php $_menu = $this->renderCategoriesMenuHtml(0,'level-top') ?>
<?php if($_menu): ?>
<ul id="nav">
<?php echo $_menu ?>
</ul>
<?php endif ?>
And Add this code here :
<?php $collection = Mage::getModel('cms/page')->getCollection()->addStoreFilter(Mage::app()->getStore()->getId());?>
<?php $collection->getSelect()
->where('is_active = 1'); ?>
<ul id="nav">
<?php foreach ($collection as $page): ?>
<?php $PageData = $page->getData(); ?>
<?php if($PageData['identifier']!='no-route' && $PageData['identifier']!='enable-cookies' && $PageData['identifier']!='home2') { ?>
<li>
<a href="/<?php echo $PageData['identifier']?>"><span><?php echo $PageData['title'] ?></span></a>
</li>
<?php } ?>
<?php endforeach; ?>
</ul>
Thats it ! Now you can see all the CMS pages in header.
If you have any problem or any query in this or if you want any help from myside, just comment on this.
Thanks !
-
Miss_tarelea
-
Rizecorp
-
http://www.programmingfacts.com PHP Freelancer
-
Nel
-
Klarzahs
-
Salim Kureshi
-
Survi
-
Malik
-
Anonymous
-
Egergerg
-
Drew
-
gaurav
-
vishwa
-
joseph12
-
http://www.magentodevelopments.com/ magento development india




