Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Breadcrumbs on CMS pages
 
seldon
Sr. Member
 
Total Posts:  92
Joined:  2007-11-08
 

Hi, currently on a cms page, there are no breadcrumbs. Is this correct? Should i recode the breadcrumbs class to enable this behaviour? Or is there another way? (or am i doing something wrong?)

Seldon

 
Magento Community Magento Community
Magento Community
Magento Community
 
seldon
Sr. Member
 
Total Posts:  92
Joined:  2007-11-08
 

Ok, i created my own MyCms module and a block class: Mage_MyCms_Block_Breadcrumbs class (just as the breadcrumbs class in the catalog/blocks). Also I added this class to the local.xml config. This class overrides the _prepareLayout function, tries to get the breadcrumbsblock and modifies it.

Now comes my big problem. What to do now? How do i make sure that on a cms page the breadcrumbs are actually displayed. Im missing a very important step here. Its actually related to my not understanding on what basis the breadcrumbs block is loaded/added to the layout in the catelog module.

Input is very welcome! :d

 
Magento Community Magento Community
Magento Community
Magento Community
 
seldon
Sr. Member
 
Total Posts:  92
Joined:  2007-11-08
 

Well, im halfway building it in myself and would very much appreciate a more concrete answer to my question smile As far as i get it now, the controller uses the main.xml to create a Layout page and loads all the blocks that are specified in the layout. Is this correct? Moreover, it cant work exactly like this, cause i dont think i could include *any* block at any point in my main.xml. Ie. I dont think a particular checkout block would work on the frontpage. So what limits the use of particular blocks?

And if it works like that, then adding my custom breadcrumbs block to the cms layout part would mean that it will load that block and render it?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Moshe
Magento Team
 
Avatar
Total Posts:  1770
Joined:  2007-08-07
Los Angeles
 

You can do something like that:
In Mage_Cms_Helper_Page::renderPage after

$action->loadLayout();
in previous release or
$action->generateLayoutXml()->generateLayoutBlocks();
in new release, add
if ($page->getIdentifier()!=='home' && ($breadcrumbs $action->getLayout()->getBlock('breadcrumbs'))) {
            $breadcrumbs
->addCrumb('home', array('label'=>__('Home'), 'title'=>__('Go to Home Page'), 'link'=>Mage::getBaseUrl()));
            
$breadcrumbs->addCrumb('cms_page', array('label'=>$page->getTitle(), 'title'=>$page->getTitle()));
        
}
 
Magento Community Magento Community
Magento Community
Magento Community
 
Moshe
Magento Team
 
Avatar
Total Posts:  1770
Joined:  2007-08-07
Los Angeles
 

We’ll include that in new release with configuration option whether to show breadcrumbs on cms pages or not.

 
Magento Community Magento Community
Magento Community
Magento Community
 
seldon
Sr. Member
 
Total Posts:  92
Joined:  2007-11-08
 

Hi Moshe,

Thanks, thats exactly what i was looking for!  Any comments on the remarks i made about the block `loading`?

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top