In this article I will be showing you how to create your own custom theme for Magento 1.4. Rather than creating a totally bespoke theme, we will create a theme based on the default theme. However, by doing this, you will have all of the information needed to create your own totally bespoke Magento 1.4 custom theme.
Directory Structure
The first part of creating your custom theme is to create your directory structure. To understand this, first we need to learn about themes and packages.Package & Theme: What's the difference?
Look at the directory structure below and see whether you recognise it.- app/design/frontend/default
- app/design/frontend/default/default
- app/design/frontend/default/default/layout
- app/design/frontend/default/default/template
- app/design/frontend/custom-theme/default
- app/design/frontend/custom-theme/default/layout
- app/design/frontend/custom-theme/default/template
In the above scenario, the default package houses 2 separate themes. In theory, a package can contain as many themes as you like. The beauty of this system is that as well as having your base theme, you can create new themes which simply enhance your base theme. This allows you to reduce the amount of code you need to write and maintain!
The Directory Structure in Magento 1.4
- app/design/frontend/base
- app/design/frontend/base/default
- app/design/frontend/base/default/etc
- app/design/frontend/base/default/layout
- app/design/frontend/base/default/template
- app/design/frontend/default
- app/design/frontend/default/default
- app/design/frontend/fishpig/default
- app/design/frontend/fishpig/default/layout
- app/design/frontend/fishpig/default/template
- app/design/frontend/fishpig/fish-theme
- app/design/frontend/fishpig/fish-theme/layout
- app/design/frontend/fishpig/fish-theme/template
Template Fall Back in Magento 1.4
This subject almost deserves an article of it's own, however, I will try and condense it here without stripping too much out. In the above directory structure, there are 3 packages:- base - contains the theme default
- default - contains the theme default
- fishpig - contains the themes default and fish-theme
When trying to access view.phtml, Magento would access the following files until either the page was found or an exception was thrown.
- app/design/frontend/fishpig/fish-theme/catalog/template/product/view.phtml
- app/design/frontend/fishpig/default/catalog/template/product/view.phtml
- app/design/frontend/base/default/catalog/template/product/view.phtml
We are now presented with two options:
- Allow our theme to fall back to base/default
- Copy over base/default files to fishpig/default and use that as our fall back
Skin folders
Just like the template and layout folders, the skin folders operate using base/default as a fall back. While templates can be vary similar cross-theme, CSS will most likely be entirely different. Because of this, the default CSS and JS are stored in default/default rather than base/default.For this example I'm going to create a package called fishpig and a theme called fish-theme. Start by creating the following folders:
- app/design/frontend/fishpig
- app/design/frontend/fishpig/default
- app/design/frontend/fishpig/default/layout
- app/design/frontend/fishpig/default/template
- app/design/frontend/fishpig/fish-theme
- app/design/frontend/fishpig/fish-theme/layout
- app/design/frontend/fishpig/fish-theme/template
- skin/frontend/fishpig
- skin/frontend/fishpig/default
- skin/frontend/fishpig/fish-theme
Now that we have created a custom theme, it is time to enable it in Magento.
In my next post I will explain about the following things
- How to Enabling our Package/Theme in Magento 1.4?
- How to Creating a template file?
- How Customising the default Magento theme?
Custom CMS are often the best option as it smoothes the transformation of mundane website into customized website. It has user-friendly features that help in updating the website easily.
ReplyDeleteMagento theme ensures that the ecommerce website is significance centric that is based on your creation theme. Magento Website Design
ReplyDeletei am still confused in base and default magento theme, what is the main different in them.
ReplyDeleteCustom CMS are often the best option as it smoothes the transformation of mundane website into customized website. It has user-friendly features that help in updating the website easily.
ReplyDeleteCustom CMS
I found your post such a informative and useful post,thanks for sharing the post. van hire luton airport
ReplyDelete