Magento Themes and Magento Extensions

Magento: Adding breadcrumbs to Homepage


1.  Register the new module (we will call the module CMS and give the development company the name Acme):

In your “magento\app\etc\modules” directory create a file named Acme_All.xml with the following content:-

<?xml version="1.0"?>

2.  Register the module (which will be implemented in the class
Acme_Cms_Block_Page) as being responsible for rewrite-ing the cms/page
In a “magento\app\code\local\Acme\Cms\etc “directory (you will need to
create it) create a config.xml file with the following content:-

<?xml version="1.0"?>

3.  Change the original block logic (based on what is in app\code\core\Mage\Cms\Block\Page.php) to handle our CMS home page.

In a “magento\app\code\local\Acme\Cms\Block” directory create a file named Page.php with the content:-

class Acme_Cms_Block_Page extends Mage_Cms_Block_Page
protected function _prepareLayout()
$page = $this->getPage();
// show breadcrumbs
if (Mage::getStoreConfig('web/default/show_cms_breadcrumbs')
&& ($breadcrumbs = $this->getLayout()->getBlock('breadcrumbs'))
&& ($page->getIdentifier()!==Mage::getStoreConfig('web/default/cms_no_route'))) {
$breadcrumbs->addCrumb('home', array('label'=>Mage::helper('cms')->__('Home'), 'title'=>Mage::helper('cms')->__('Go to Home Page'), 'link'=>Mage::getBaseUrl()));
if ($page->getIdentifier()!==Mage::getStoreConfig('web/default/cms_home_page')){
$breadcrumbs->addCrumb('cms_page', array('label'=>$page->getTitle(), 'title'=>$page->getTitle()));
if ($root = $this->getLayout()->getBlock('root')) {
if ($head = $this->getLayout()->getBlock('head')) {

Be sure that you have enabled breadcrumbs for CMS pages
[Config->Web->Default Pages->Show breadcrumbs for CMS pages =

Leave a Reply

You must be logged in to post a comment.