Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 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

like image 305
byronyasgur Avatar asked Jun 30 '11 00:06

byronyasgur


People also ask

What is the difference between child and templates?

A child theme may only contain one style. css file and a few lines of CSS which change the appearance of the parent theme whereas a parent theme contains a complete file structure with templates and a fully coded style sheet.

What is the WordPress template hierarchy based on?

The WordPress template hierarchy determines which PHP template files will be used to construct a given webpage on your site, based on the type of post content requested: for example, whether the webpage displays a Page, a Post, or an archive of many Posts.

What is the difference between WordPress theme and child theme?

A child theme is an add-on for your existing WordPress theme A child theme, as defined by the WordPress Codex, is a theme that “inherits the functionality and styling of another theme, called the parent theme.” Child themes are recommended to modify existing themes while still maintaining their design and code.

When should you use a child theme WordPress?

Child Themes are used when customization to function and/or style of the parent theme is required. Here, one is used to change what is displayed in the footer / copyright. But this article is not about what child theme is, it's about whether you need to use one in your WordPress website or not.


1 Answers

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.

like image 52
Alan Storm Avatar answered Oct 22 '22 23:10

Alan Storm