13

Here is the situation: I have several self made modules, all tested and working using the default theme. Then we bought and installed a new theme. Switched to the new theme and the modules are not shown. After several try/fail tests I found that I needed to copy the corresponding layout and template files to the corresponding folders of the recently installed theme.

So, my question is: what should I do in order to get all my modules working with any theme installed after the module setup?

  • 1
    If you put your layout files in design/frontend/base/default/... they'll be shown whatever the theme is – Sander Mangel Jan 22 '13 at 21:46
17

Put everything in the base/default paths.

Example:

app/design/frontend/base/default

skin/frontend/base/default

  • Ouch! didn't thought about it, you are right, will test as soon as arrive to the office. – Yaroslav Jan 22 '13 at 22:08
  • +1 -- There are too many modules out there labeled as "community" that don't follow this practice and they should. – pspahn Jan 22 '13 at 22:27
  • The base template was introduced in Magento 1.4. to solve exactly this problem. On earlier versions copying the templates files, if you were not using the default package, was the way to do it. – Kristof at Fooman Jan 25 '13 at 9:43
5

The hard truth is, you can't really guarantee that they will be. Putting your files in base/default (or default/default if they override core templates - as you don't want to overwrite base files with a module install, though this forces you to keep duplicates for enterprise edition) will guarantee that they become the fallbacks, but theme files will always be highest level priority.

Most modules come with an install guide, which includes mentioning to copy the template files to the user's theme if they have a custom one. That's about the best you can do.

4

One thing that we've used a couple of times is [Fabrizio Branca][1]'s [Custom Fallback][2] modlue. It's a very useful module for specifying your own custom theme fallback hierarchy. One thing you can do is specify:

  1. custom/theme

  2. base/default

  3. default/default

Then any modules that put their own templates in the default/default theme. Won't work if they are trying to override base/default packages.

You can specify any number of packages/themes in the custom fallback hierarchy.

[1]: http://www.fabrizio-branca.de/ [2]: http://www.fabrizio-branca.de/custom-design-fallbacks-in-magento.html

2

Any template and layout file in base/default will be loaded unless it is overridden somewhere along the path. However if your custom module is a widget of some sort, then you should make sure it is echoed where ever needed. If for example you are making changes which are shown on product page via getChildHtml, then those calls should be in corresponding theme as well. If however your module templates are pages by themselves and they are not loaded from base/default, then something blocks layout configuration and you should find what.

  • Very interesting the comment about the getChild, I have indeed some calls of this kind. – Yaroslav Jan 22 '13 at 22:08
1

There isn't a simple answer of this. It depends on the modules that you have. For instance, some module companies, overriding the core files. Therefore, you should first check what files available in the app/etc/modules and app/code/local/Mage, app/code/community/Mage folders. As you might know, first folder is a module initialization folder which you can disable or enable the modules related by xml files. Last two folders ( if it's available ) are core code overriding folders.

Then, open one of the xml file that available etc/modules directory. You will see something like below :

<?xml version="1.0"?>
<config>
<modules>
    <Company_Namespace>
        <active>true</active>
        <codePool>local</codePool>
    </Company_Namespace>
</modules>

Here is the important parts are Company and Namespace. When you visit the app/code/local or app/code/community folders, you will see a folder named Company and following by a sub folder named Namespace.

When you lookup the Namespace you will see a sub-folder named /etc. This folder keeping module related config file config.xml. This file has module related config lines that you can refer what files related this module.

As I said in my first line, it's hard to manage.

  • I think you missed the point of the question. He was asking about layout updates. Best practice is to use a base/default/yourmodule path. – Mark Shust Jan 23 '13 at 16:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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