In his soon to be referenced widely Magento Infinite Theme Fallback Fix, Eric Wiese notes that layout update XML files added via theme.xml
are ignored by the parent/child theme inheritance. An XML file added to a parent’s theme.xml
will not be added automatically to the child theme’s layout.
Eric’s solution is a custom module that makes theme inheritance consider these files.
If installing a module isn’t a solution available to you, here’s another option. Just specify the file from the parent theme you’d like in the child’s theme.xml
.
In Eric’s example his US theme’s theme.xml
<?xml version="1.0"?>
<theme>
<parent>mycompany/corporate-base</parent>
<layout>
<updates>
<us_default>
<file>us/default.xml</file>
</us_default>
</updates>
</layout>
</theme>
Could be changed to the following
<?xml version="1.0"?>
<theme>
<parent>mycompany/corporate-base</parent>
<layout>
<updates>
<us_default>
<file>us/default.xml</file>
</us_default>
<corporate_base_default>
<file>corporate-base/default.xml</file>
</corporate_base_default>
</updates>
</layout>
</theme>
With this in place, his new theme would pickup the corporate-base
updates. Notice we haven’t added corporate-base/default.xml
to the US theme — all we’ve done is configure its name in theme.xml
. The fallback system takes care of the rest.
If you’re curious why this works, my longer Magento 1.9 Infinite Theme Fallback article may be of interest.