Is there a good method for retrieving the page title and url of the parent CMS page when using Magento's CMS Hierarchy?

Example Structure:

  • About Us
    • Culture
    • Contact

I need to be able to get the About Us page title on Culture and Contact pages.

The only method I've come up with is this terrible code which grabs the parent page's title:

<?php echo ($_tree[0][3]->getData("page_title")); ?>

Right now it's showing the current page title instead of the parent page title: http://grab.by/Drl4 as I'm using the code:

<?php echo str_replace(Mage::getStoreConfig('design/head/title_prefix'), '', $this->getLayout()->getBlock('head')->getTitle()); ?>

Any ideas of a reusable and clean method to grab the parent CMS page's title and url?

side note : I have editition with me.

  • 1
    There is no CMS page hierarchy in CE/EE, are you using Go or an extension? Commented Dec 30, 2014 at 21:42
  • No extension. It's Magento Enterprise's Hierarchy: grab.by/Droc
    – Gil
    Commented Dec 30, 2014 at 21:46
  • You would think I'd actually check first, yep I see it under content management (shows how much I use that particular setting!) Commented Dec 30, 2014 at 21:57

1 Answer 1


Here is the solution for you:

if ($currentNode = Mage::registry('current_cms_hierarchy_node')) {
    // Zend_Debug::dump($currentNode->getData());
    $parentId       = $currentNode->getParentNodeId();
    $parentNode  = Mage::getModel('enterprise_cms/hierarchy_node')
    // Zend_Debug::dump($parentNode->getData());

    $parentTitle    = $parentNode->getPageTitle();
    $parentUrl      = Mage::getUrl($parentNode->getRequestUrl());
    // Zend_Debug::dump($parentTitle);
    // Zend_Debug::dump($parentUrl);

You can run this code from any .phtml file.

  • Don't you think your commented out code is a bit superfluous for the answer? (Not to mention using a deprecated commenting method...)
    – Navarr
    Commented Feb 16, 2015 at 18:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.