I'm in the process of converting my company's web site to Magento 1.9. We've purchased a theme, but need to make some design changes such as adding javascript and css files to the header.
I'm new to Magento, but I believe that the changes we need to make would typically be made by modifying the local.xml file of the theme. My purchased theme, however, already has a very detailed local.xml. I'm hesitant to modify this because I assume it's likely to change if the theme is updated. I've tried overriding the layout under Config->Design->Themes->Layout, but when I create my own local.xml, of course the primary file is never loaded.
Is it possible for my overridden local.xml to indicate that the parent file should be ran as well? Or is there a better way to accomplish what I'm trying to do in general? I believe I could create a module that applies our layout changes, but that doesn't seem like the "right" way to do it.
Best Answer
No. Unfortunately for
local.xml
the same fallback mechanism applies as for all other theme files, i.e. the first one in the theme inheritance tree is used and there is no way to include a parent explicitly.Yes, but it's still not ideal. Since Magento 1.9 you can use
theme.xml
for layout updates and it is actually the preferred way overlocal.xml
. (Read more: https://erfanimani.com/dont-use-local-xml/)If the purchased theme uses only
local.xml
and no layout updates intheme.xml
, you can usetheme.xml
for your own changes. But note thattheme.xml
is loaded beforelocal.xml
, so if the order of actions matters, this might not work for you.What if the parent uses
theme.xml
for layout updates as well? Now, the layout updates of parenttheme.xml
files are not loaded either, but sincetheme.xml
works different thanlocal.xml
, there is a fix for that: https://github.com/ericthehacker/magento-themefallbackfixAnd there is another option, which is probably the "right" way: You can also define layout files in
theme.xml
. You'll still need to copy these definition for child themes but that's only a few lines.Example
mytheme/default/etc/theme.xml
mytheme/child/etc/theme.xml