سؤال

I can't seem to find an example of how to use the Enterprise Edition CMS Hierarchy functionality within my theme. The admin interface is simple enough, but its useless if I can't access that information to dynamically build menus! I've contacted Magento directly and they have not been able to provide me any kind of documentation and told me that they "do not support theme development." Awesome :)

Can someone please help me out? All I really need is that little piece of code that will give me either an object or an array with the CMS hierarchy info, page titles and links and I'll be good to go. Thanks!

هل كانت مفيدة؟

المحلول

I have been working on getting this data for some time, finally managed to devise a solution. Here's the code I used.

<?php
$_menu = Mage::app()->getLayout()->createBlock('enterprise_cms/hierarchy_menu');
$_menu->setNodeId(1); //change to the id number of the desired node
$_menu->_construct(); //calling construct method again after setting node
$_tree = $_menu->getTree();
echo $_menu->drawMenu($_tree,1); //this number should match the one above

//show the full collection
//echo "<pre>";print_r($_tree);echo "</pre>";

//uncomment the following block of code for detailed debug info
/*foreach ($_tree as $_nodes) {
    foreach($_nodes as $_slice){
        print_r($_slice->getData());
        echo "<br /><br />";
    }
}*/

?>

نصائح أخرى

There is a block Enterprise_Cms_Block_Hierarchy_Menu which generates output for hierachical menus. You can even get the contents via the getTree method and build the output on your own.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى magento.stackexchange
scroll top