Take the 2-minute tour ×

I'm a newbie with Magento CE and I'm trying to learn to design a new theme. I've started studying the default desing package. There is one thing I cannot understand:

This is the header section in page.xml:

                <block type="page/switch" name="store_language" as="store_language" template="page/switch/languages.phtml"/>
                    <label>Navigation Bar</label>
                <block type="page/html_wrapper" name="top.container" as="topContainer" translate="label">
                    <label>Page Header</label>
                    <action method="setElementClass"><value>top-container</value></action>

And this is header.phtml:

<div class="header-container">
    <div class="header">
        <?php if ($this->getIsHomePage()):?>
        <h1 class="logo"><strong><?php echo $this->getLogoAlt() ?></strong><a href="<?php echo $this->getUrl('') ?>" title="<?php echo $this->getLogoAlt() ?>" class="logo"><img src="<?php echo $this->getLogoSrc() ?>" alt="<?php echo $this->getLogoAlt() ?>" /></a></h1>
        <?php else:?>
        <?php endif?>
        <div class="quick-access">
        <?php echo $this->getChildHtml('topContainer'); ?>
<?php echo $this->getChildHtml('topMenu') ?>

I cannot understand why the topSearch block is being loaded even if it is not declared in the header in page.xml as a child of header.

Could anyone explain? Thanks!

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

In your theme's layout/catalogsearch.xml, you will see this one:

<reference name="header">
     <block type="core/template" name="top.search" as="topSearch" template="catalogsearch/form.mini.phtml"/>

The Catalogsearch is an own module in Magento's core. When digging deeper into magento and developing own modules/overriding core modules, you will notice that this is the normal way to add "dependent" things to the layout. When you disable the catalogsearch module, topSearch will not be added to the header anymore automatically.

Imagine if you would disable it, and the XML would still call for the block - the more modules you have, the more a mess it would be, as you would have to check all existing layout files every time you disable a module if it is somewhere in there.

Regarding your comment:
Magento as a whole mainly consists of modules in the three namespaces found in app/code/, namely core, community and local. While community and local are for extensions (in magento-language just another word for modules) installed via Magento Connect or built by yourself, the core-namespace contains the magento codebase. All of the modules make up a normal magento installation, but they are still "modules". They can be disabled individually, changed, overridden and so on.

If you want a list of modules installed in your store, I recommend this extension: https://github.com/firegento/firegento-debug/

If you want to know more about the magento structure, you should read Alan Storm's series at magentocommerce.com: http://www.magentocommerce.com/knowledge-base/entry/magento-for-dev-part-1-introduction-to-magento, as well as everything else written by him ;)

There is also a list of all classes and functions used in magento-core: http://docs.magentocommerce.com/

share|improve this answer
Thanks for your answer! So there are soe sort of modules in Magento that I can call from anywhere? Is there a list? Sorry to bother you, I think the documentation is very poor... –  checcco Mar 30 '13 at 16:25
Updated my answer. –  simonthesorcerer Mar 30 '13 at 16:45
add comment

Your Answer


