4

I'm trying to work through the exercises in the Magento study guide. I've come the following:

Add an additional hardcoded theme called “primary” that is always first in the fallback order in the configured package. Then add an additional fallback theme base/[configured-default-theme] that is always evaluated just before the base/default fallback. Create a test action that allows you to test all 6 possible template fallbacks at once.

But I am not clear what the '6 possible template fallbacks' are in question.

I came up with

  • default/primary
  • default/anothertheme
  • default/default
  • base/primary
  • base/anothertheme
  • base/default

Assuming I have set my default theme to 'anothertheme', but not sure if that is correct, as looking through the code only base/default is used, after the first 3

Any ideas?

1 Answer 1

1

The exercice question is somehow unclear and the answer will depends on the Magento version.

Magento < 1.9

In versions of Magento before 1.9 here is how the fallback system used to work:

  • exception defined when clicking Add Exception is picked first in case the user agent matches
  • the theme defined in the backend in then picked: <yourpackage>/<your_theme>
  • the default package theme is picked: <your_package>/default
  • the base/default theme is picked

Magento >= 1.9

In Magento 1.9, an infinite fallback system has been introduced. You can find a great article explaining by Alan Storm here: http://alanstorm.com/magento_parent_child_themes

The idea is that you can create an etc/theme.xml in any theme folder that will declare the inheritance between the theme and a parent theme. For example if you create app/design/frontend/<your_package_1>/default/etc/theme.xml with the following content:

<?xml version="1.0"?>
<theme>
    <parent>your_package_2/default</parent>
</theme>

And then you create app/design/frontend/<your_package_2>/default/etc/theme.xml with the following content:

<?xml version="1.0"?>
<theme>
    <parent>rwd/default</parent>
</theme>

That will make the fallback system like this:

  • exception defined when clicking Add Exception is picked first in case the user agent matches
  • <your_package_1>/default
  • <your_package_2>/default
  • rwd/default
  • base/default

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.