Magento Folder Structure Revealed


Magento is a feature-rich, professional open-source eCommerce software which offers unprecedented flexibility and control over its look, functionality and content. The most striking feature of Magento is that it is 100% customizable. You can have your own version of Magento.
Magento strictly follows the MVC architecture. This means that you can change the total look and feel of your Magento application without touching the inner logic of it and vice-versa.
Before you dive deep inside Magento, it will be helpful if you understand where to look for what.

Exploring the app/ folder

Magento Modules


Right, before you get lost, let me take you to the app/code/ folder. And inside it, you will see three folders:

  • core/
  • community/
  • local/

core/: Holds the default Magento modules.
community/: Contains modules developed by the Magento community.They can be installed using the Magento Connect Manager with an extension key.
In addition to the above two categories, you can develop modules yourself and keep them inside the local/ folder.

Design and Templates

When designing your Magento application, you will need to change the files in the app/design/ folder. In this folder, the design is broken into three parts so that there is no ambiguity about which part of the application is getting changed :
adminhtml/ – Holds the design of the administration side.
frontend/ -Has the design of the store front.
install/ -Used during installation.

Furthermore, each of these folders hold the themes that Magento uses. The default theme is stored in the default/ folder , which is broken into:
layout/ -xml files are located .
locale/ -Stores the language files .
template/ – Has the phtml files.

Core Configuration of Magento

Have a look inside the etc/ folder to view the configuration files of Magento. There is an important file called local.xml which contains the database connection details and the modules/ folder, where the declarations of magento modules are present.

E-mail templates, Language files

Peek inside the locale/ folder to see the language files and e-mail templates. You will find many sub-directories, for each language set up in your store. Inside these sub-directories, you will also find .csv files for each module installed on the system.
E-mail templates are stored inside the template/email/ folder and those related to sales are inside template/email/sales/.

What is Mage.php?

This is a very important file containing the class Mage, which glues together all the Magento modules, functions and files. To call a Magento function in a program outside the Magento application, you should ‘require’ or ‘include’ the Mage.php file in the program and use the class Mage. Mage has functions like getModel(), getSingleton() that will allow you to call a specific function from any module of Magento.
So much for the app/ folder. Let us get out of it now.

Usefulness of the Magento Connect Manager

Magento Connect is a facility inbuilt in Magento for downloading extensions, modules and even for updating the existing Magento installation.
downloader/ – This is the folder that contains the core files required for Magento Connect Manager to work. Since the rate at which Magento keeps getting updated to newer versions is exponentially high, no one would enjoy the tedious and cumbersome task of frequently updating their existing Magento installation. But there is a very easy-to-do Magento update process:
1. Go to Magento Connect Manager.
2. Paste the extension key – magento-core/ Mage_All_Latest.
3. Click!
Also, say, you can’t read the text containing important information regarding the upgrade. Not to worry. You can change the CSS in the downloader/skin/ folder.

Change the CSS, images and javascripts specific to your theme

That is what the skin/ folder is all about. This folder is where all the design specific CSS, images and javascripts go, for the template (theme) you use. It has the following sub-folders in it:
adminhtml/ – Holds the design of the administration side.
frontend/ -Has the design of the store front.
install/ -Used during installation.

Media Files

The folder media/ stores all the images that you upload to Magento and also the images resized dynamically by Magento.
media/import/ is the place to store images of the products imported via profiles (Magento Admin Page->System->Import/Export->Profiles).

Temporary Files – Cache, Session Files

The var/ folder holds all the temporary Magento files. So whenever you need to flush the cache, This is where you go. An alternative method to flush the cache is to go to the Magento Administrator side – System->Cache Management and refresh.

External Code Library

Magento, which was created by Varien is built on the components of the Zend framework. The lib/ folder holds the external code library of Zend, Varien.

Javascripts for Magento

An easy to locate folder, js/ contains the javascript files required for the proper functioning of Magento.
That pretty much covers the basics of Magento for a novice Magento developer. Magento allows its users to have total control over his/her application. So, the degree of freedom is limited only by your imagination . Magento is all yours. Happy Developing!