dmertl.com

breadcrumbs

Magento – Override a core page block

October 26, 2010 by dmertl 6 Comments

Using Magento 1.4.1.1.

After reading a seemingly simple tutorial at http://www.exploremagento.com/magento/override-a-magento-core-block-class.php I ran into some problems. To override the catalog modules breadcrumbs you use the following XML:

<config>
    <global>
        <blocks>
            <catalog>
                <rewrite>
                    <breadcrumbs>Fido_Catalog_Block_Breadcrumbs</breadcrumbs>
                </rewrite>
            </catalog>
        </blocks>
    </global>
</config>

This is fine for the catalog module, but how do you replace the standard breadcrumbs in 1.4.1.1 which are in core/Mage/Page/Block/Html/Breadcrumbs.php? It took me quite a bit of trial and error, but the key here is the declaration of the block in page.xml:

<block type="page/html_breadcrumbs" name="breadcrumbs" as="breadcrumbs"/>

The type is what indicates how to override. Specifically “page” and “html_breadcrumbs”. To properly override the standard breadcrumbs you would use the following XML:

<config>
    <global>
        <blocks>
            <page>
                <rewrite>
                    <html_breadcrumbs>AIBooks_Page_Block_Html_Breadcrumbs</html_breadcrumbs>
                </rewrite>
            </page>
        </blocks>
    </global>
</config>

The rest of the article should apply just fine. In my package I mirrored the core code with app/code/local/AIBooks/Page/Block/Html/Breadcrumbs.php with your XML going into app/code/local/AIBooks/Page/etc/config.xml.

Posted in: Magento, Uncategorized Tagged: breadcrumbs, Magento, override, php

Blogroll

  • Antarctica
  • Non-coding stuff
  • Photos
  • Rainbows

Recent Posts

  • Resizing optimized animated GIFs in Photoshop
  • Saving an animated GIF in Photoshop with “combine” instead of “replace” frames
  • Mimicking Django Admin Change Form Styling in a Custom Form
  • Installing custom Plex plugins on a Drobo 5N
  • Bug in CakePHP Containable Behavior, Related Records not Being Returned When Parent Contains a Single Field

Categories

  • CakePHP
  • Canon
  • Django
  • Doctrine
  • iPhone
  • mac
  • Magento
  • MS Access
  • MSSQL
  • Photography
  • Python
  • SQL
  • Uncategorized
  • Zend

Tags

@@IDENTITY adapter authentication breadcrumbs CakePHP Canon cocoa Doctrine email eos utility errors iPhone leopard lost cd mac Magento MS Access MS SQL mysql mysqli nosuchtable os x override parse pdo_mysql.php php programming raw redirect smtp SQL sqlite SQL Server triggers updater validation xcode Zend zend_mail_message

Copyright © 2023 dmertl.com.

Omega WordPress Theme by ThemeHall