Bobcares

Magento Folder Structure Revealed

by | Nov 4, 2009

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!


About the Author :

Meriya Susan Thomas, works as a Junior Software Engineer in Bobcares. She joined Bobcares in June 2009, and loves developing web based PHP applications. Her other technical interests include Magento Development and C/C++ programming. During her free time, Meriya loves listening to music, playing piano and reading books.


11 Comments

  1. renjith

    nice article…

  2. Mike

    thank you Meriya.

    Great article.

    Mike

  3. Rims

    Really good one….

  4. Randy

    As I was reading your post I wanted to find out about function folder because I need that to use the loader which came with the program I received and downloaded it to my server.

    On Magento sit their is no data on how to find it!

    any help would be helpful.

    Your post is vary well done.

  5. lavanya

    nice article , thank you

  6. Brett

    Awesome post! I was mining the whole internet to find a simple and straightforward tutorial to explain the structure and working. God Speed!!

  7. srinu

    nice article………,thank you.

  8. gagan

    Explain me what is the role of zend folder and mime.php file in it?

  9. Nazmul Hassan

    What a great article…

    I would like to kiss her…

    Thanks

  10. hitesh

    v good easy to understand

  11. Rudra

    Realy It’s Helpfull

    Thanx

Never again lose customers to poor
server speed! Let us help you.