开发者

Does template hierarchy work the same in magento as child themes do in wordpress

I am new to magento and i'm confused about themes. I bought a theme and got it installed and now i need to make some changes.

In wordpress ... ( which i am used to) what i would do at this point is开发者_JAVA技巧 to make a child theme ( which is essentially one css file with a tiny bit of code in it ) .... and any changes in that child theme would override the parent theme in that area only while the parent theme would govern everything else, the advantage being that when it comes to updating the theme i dont need to maintain a "hacks list" and reimpliment all my modifications.

However the people who sold me the theme make no mention of anything like this, and suggest simply editing the theme itself, despite the fact that magento has a "theme hierarchy"

So can anyone explain this to me, Does template hierarchy work the same in magento as child themes do in wordpress... and if not what is the procdeure for updating the theme vis a vis keeping the theme alterations made by the site developer from the original downloaded version


Does template hierarchy work the same in magento as child themes do in wordpress

No.

what is the procedure for updating the theme vis a vis keeping the theme alterations made by the site developer from the original downloaded version

Starting from the bottom, Magento (post 1.4.1.1) has a theme folder at

app/design/frontend/base/default

This is the final place Magento will look for any particular template file. Only people who know why they'd want to edit/add files in there should edit or add files in there. And even most of them shouldn't.

Next up (and this is confusing, so pay attention, and don't feel bad if you're confused), Magento has the concept of a default theme. This is a theme name you configure in

System -> Configuration -> Design -> Themes -> Default Theme

This default folder is where you can put your base theme. If you entered the value theirtheme, Magento would look for theme template and layout files in

app/design/frontend/default/theirtheme/template
app/design/frontend/default/theirtheme/layout

Next up, themes are made up of

  • Layout XML files
  • Templates
  • Translation files
  • "Skin" files (which live outside the app/design hierarchy)

Each of these has a configuration area in

System -> Configuration -> Design -> Themes

So, let's say you configured the Templates config value with the value mytheme, and your Default was set, as above, to theirtheme. Magento would first look for phtml template files in

app/design/frontend/default/mytheme/template/path/to/file.phtml

If it didn't find one there, it would look to the default theme that you configured

app/design/frontend/default/theirtheme/template/path/to/file.phtml

Finally, if it didn't find one in either place, it check one last time in

app/design/frontend/base/default/template/path/to/file.phtml

So, it sounds like what you want to do is make the theme you downloaded your default theme, and then configure a custom folders where you can add your changes.

Other Notes

The word frontend in

app/design/frontend

is a area. An area roughly corresponds to a single web application. The frontend area is the shopping cart, the adminhtml area is the Admin Console.

The first default in

app/design/frontend/default

is the Design Package folder. A design package is a collection of themes. This often causes confusion, since the default package has nothing to do with the default theme, but they share the same, um, default name.

Finally, w/r/t what your theme vendor told you, Magento's still a young platform and it's in flux, and the best practices for these sorts of things are still sorting themselves out. It's often going to be up to you to decide the best way to take advantage of Magento's various systems.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜