Why should i learn about folder structure? Because it is Magento. and I think it is the most important part in Magento.
Before we learn about themes and extensions, we should know how folders should be created/placed.
Why this is required?
Suppose product details file is missing from our server, what will happen? Product information page will be blank in front-end! So Magento devs came up with wonderful idea.
They created three different locations for same layout/template/css files. so now from above example if product detail file is missing in one folder,Magento will look into second folder for that file,if it didn’t find there, it will look into third folder for the same file. Interesting!? Lets dig into it.
Understanding Magento Folder Structure
We should know about these three folders to modify the store as per requirement :
1) Design 2) Skin 3) Code
This folder path is Magento_folder/app/design, It consists of three folders:
1) adminhtml : It is used to render admin panel.
2) frontend : As name suggests, it will render our front-end. Here is the main part, It also consists of three folders:
- base : It consists of Magento default code. (One should avoid editing these files, we can copy required files to same hierarchy in default or theme folder.)
- default : It may content theme and default code both.
- package_theme_folder : It is your theme folder. (In Magento 1.9 there is rwd folder, it is theme of this new version.)
All these three folders consist layout (.xml files) and template (.phtml files) folders.
3) install : It is used to render installation pages.
This folder path is Magento_folder/app/code. It consists of php code, It is divided in three folders/code pools.
- core : Default Magento code. (Do not modify this code. Ever!)
- local : Locally created extensions.
- community : Externally/third party created extensions.
As we know Magento is following mvc structure, so mostly all folders in these code pools will have Block,controller,etc,Model and Helper.
It will have same structure like Design folder. Just the difference is it will include css,js and Images folder instead layout folders.
Look at this image, You will be more clear about folder structure.
Note 1: To edit Magento’s default code copy that file in same hierarchy to app/code/local/Mage folder.
Note 2 : Magento will search template/css files in following folders respectively .
1. Package/ Theme_name
So this was all about Magento folder structure, Hope now you are clear about this. Let me know if any questions in comments.
Latest posts by Ankur Dholakia (see all)
- Create module in magento 2 - January 12, 2016
- Magento 2 – Theme Development and Theme Structure - January 6, 2016
- Magento themes | Magento templates | Responsive Magento themes - December 12, 2015