2
votes

Is there a way to get the hierarchy parent of the CMS page in Magento - or - getCollection of children CMS pages of the particular page?

This task appears to be simple, but in the dump of the properties and methods of magento cms page object, there is no thing like parent or something like that.

1
I remember having the same issue, I think you need to have a look to the model 'enterprise_cms/hierarchy_node' - adrien54

1 Answers

2
votes

If you take a look at the Enterprise_Cms_Model_Hierarchy_Node object you can see it contains a parent_node_id.

(Also, see DB table enterprise_cms_hierarchy_node)

To get the node object from a CMS page ID you could do the following:

$collection = Mage::getModel('enterprise_cms/hierarchy_node')->getCollection()
$collection->addFieldToFilter('page_id', array('eq' => $yourCmsPageId));
$collection->getFirstItem();