nileco-logo-small-text5
  • HOME
  • PROJECTS
  • SERVICES
  • ABOUT
    • WHO WE ARE
    • TESTIMONIALS
  • MAGENTO BLOG

Create an automated navigation menu of all CMS pages in Magento

Code Snippets for MagentoJune 13, 2014CJ

If you have a lot of CMS pages, or if you just like automation and organization then this little snippet might be of some help.  This will add the link to every CMS page in a clickable list that can be styled and displayed on the template page that you are using for CMS pages.

<div>
<span>Here I am</span>
 <?php $collection = Mage::getModel('cms/page')->getCollection()->addStoreFilter(Mage::app()->getStore()->getId());?>
 <?php $collection->getSelect()
 ->where('is_active = 1'); ?>
 <ul>
 <?php foreach ($collection as $page): ?>
 <?php $PageData = $page->getData(); ?>
 <?php if($PageData['identifier']!='no-route') { ?>
 <li>
 <a href="/<?php echo $PageData['identifier']?>"><?php echo $PageData['title'] ?></a>
 </li>
 <?php } ?>
 <?php endforeach; ?>
</div>
Previous post Changing the default Tax Class for Magento Products Next post How to Automatically add Related Products in Magento

1 comment. Leave new

website
December 28, 2014 3:10 am

I truly appreciate you taking the time to share this information with us.

Reply

Leave a Reply Cancel reply

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

© 2016 All rights reserved. nileco