Magento 1.5 extension layouts

In Magento, most extensions that actually do something visible need a .xml layout file. In 1.3 those files were usually distributed in app/design/default/default/layout – but in 1.5, if you have a custom design, those files won’t be used. According to this post the best place to put layout files for an extension is in app/design/base/default/layout – this means that even if you have your site’s custom theme at app/design/sitename/default, the extensions will still work.

However, most of the ‘1.5-compatible’ extensions we’ve looked at still put layout files in default/default. This means that you have to copy the extension’s layout, templates, and skin files into your custom theme, even if you don’t want to change any of them.

Here’s an example from a purchased extension:

/app
/app/design
/app/design/frontend
/app/design/frontend/default
/app/design/frontend/default/default
/app/design/frontend/default/default/template
/app/design/frontend/default/default/template/Extension
/app/design/frontend/default/default/template/Extension/catalog_products.phtml
/app/design/frontend/default/default/template/Extension/catalog_categories.phtml
/app/design/frontend/default/default/template/Extension/pages.phtml
/app/design/frontend/default/default/template/Extension/links.phtml
/app/design/frontend/default/default/template/Extension/container.phtml
/app/design/frontend/default/default/template/Extension/store_switcher.phtml
/app/design/frontend/default/default/layout
/app/design/frontend/default/default/layout/Extension.xml
/app/code
/app/code/local
/app/code/local/Company
/app/code/local/Company/Extension
/app/code/local/Company/Extension/Helper
/app/code/local/Company/Extension/Helper/Data.php
/app/code/local/Company/Extension/sql
/app/code/local/Company/Extension/Model
/app/code/local/Company/Extension/Model/Extension.php
/app/code/local/Company/Extension/Model/Mysql4
/app/code/local/Company/Extension/Model/Mysql4/Sitemap
/app/code/local/Company/Extension/Model/Mysql4/Sitemap/Collection.php
/app/code/local/Company/Extension/Model/Observer.php
/app/code/local/Company/Extension/controllers
/app/code/local/Company/Extension/controllers/IndexController.php
/app/code/local/Company/Extension/Block
/app/code/local/Company/Extension/Block/Pages.php
/app/code/local/Company/Extension/etc
/app/code/local/Company/Extension/etc/system.xml
/app/code/local/Company/Extension/etc/config.xml
/app/etc
/app/etc/modules
/app/etc/modules/Company_Extension.xml
/skin
/skin/frontend
/skin/frontend/default
/skin/frontend/default/default
/skin/frontend/default/default/css
/skin/frontend/default/default/css/Extension.css

What we’re doing to make this work is


mv skin/frontend/default skin/frontend/base
mv app/design/frontend/default app/design/frontend/base

The result of this will be that even when we have a custom theme, this extension’s layout files will be applied without having to copy them to the theme-specific package.