Saturday , October 21 2017
Home >> All tutorial >> Folders Structure and Database System in Magento (part 1)

Folders Structure and Database System in Magento (part 1)

Here is the guide from Magento tutorial for beginners team  about the Folders Structure and Database System in Magento. The post is clear and make sense, hope you love this tutorial!


1. Folder Structure of Magento

Magento platform is built based on object-oriented programming by Model–view–controller (MVC). The structure of Magento is not complex as many people said. The Magento code system is stored in the form of dispersion with the purpose to raise the expansion ability for the system. As you can see, the folders system  is stored in host like this:

Magento tutorial for beginners: image

2. Structure of a Magento module

If we want to extend the functionality and features of Magento platform, the best solution here is install a Magento extension. Modules from other software may be is very common and you can see modules anywhere, module is any of a number of distinct but interrelated units from which a program may be built up or into which a complex activity may be analyzed.

As you can see, the picture below describe the main folders of a Magento module:

folder structure of Magento

Another point we must know is that code folders of a Magento module which are  written in the folder app/code/local include:

–      <Namespace( is a unique name that identifies your company or organization. The intent is that each member of the world-wide Magento community will use their own Package names when creating modules in order to avoid colliding with another user’s code,  above is Magestore)>

  • <Module’sname ( above is one step check ou extension>
    • Block: This folder include blocks, which is the driver behind the arrangement of Magento templates
    • Helper: This folder include the help files, containing utility methods that will allow you to carry out common tasks on objects and variables.
    • Controllers: This folder include module’s controllers, containing control layers of application flow. They receive input which is users’ requests via HTTP header and then forward the request to the layer directly in charge of processing requirements.
    • etc: This folder include module’s configuration files, containing configuration files of a module (XML file). Based on the configuration file, we can set up or overwrite the old settings just by placing the correct XML tags.
    • Model: This folder include module’s models, Layers providing data and services related to data and business logic. These classes work directly with the database and provide data for other components.
    • sql: This folder include module’s data installation files, containing files of installation and database update of the module database.

Besides code folders, we have folders containing files about interface, configuration, language, etc.

–      layout: (/app/design/frontend/packagename/themesname/layout). Layouts are basic XML files that define the block structure for different pages, as well as controlling the META information and page encoding. This is a importan file of Magento. Layout files are separated on a per-module basis, with every module bringing with it its own layout file.

–      template: (/app/design/frontend/packagename/themesname/template). Templates are PHTML files that contain (X)HTML markups and any necessary PHP tags to create the logic for the visual presentation of information and features.

–      Skins: (/skin/frontend/packagename/themesname) default Skins are block-specific JavaScript and CSS and image files that compliment your (X)HTML. This file is where your theme is stored, in other word, your front-end folder is here.

Others file that you should know about Magento:

  • .htaccess – This file includes mod_rewrite rules, which are essential for the Search Engine Friendly URLs. There you can also find standard web server and php directives that can improve your web site performance;
  • 404 (directory) – This file includes the default 404 template and skin for Magento, if any one go to a wrong url, the visitor will be move to the 404 page.
  • app (directory) – Including the modules, themes, configuration and translation files. Also there are the template files for the default administrationtheme and the installation;
  • cron.php – a Cron Job should be set for this file. Executing of the file on a defined time period will ensure that the complicated Magento caching system will not affect the web site performance;
  • downloader (directory) – This is the storage of the web downloader files. They are used for the installation and upgrade of Magento through your browser;
  • favicon.ico – This file is for the default favicon for Magento. When customer visit your website, there is a small icon that is shown in the browser’s tool bar.
  • index.php – This is the most important file, it is the main index file for Magento;
  • index.php.sample – A backup of the default index file. It can be used to revert the changes in a case of a index.php modification;
  • js (directory) – Contains the pre-compiled libraries of the JavaScript code included in Magento;
  • lib (directory) – The Magento core code is located in this folder. It contains the software’s PHP libraries;
  • LICENSE_AFL.txt – The Academic Free License under which the Magento software is distributed;
  • LICENSE.txt – the Open Software License under which the Magento software is distributed;
  • media (directory) – This is the storage of the Magento media files – images out of the box, generated thumbnails, uploaded products images. It is also used as a container for importing images through the mass import/export tools;
  • pkginfo (directory) – Contains files with information regarding the modules upgrades’ changes;
  • php.ini.sample – This file contains sample php directives that can be used in order to modify your PHP setup. If you want to alter the default setup edit the file and then rename it to php.ini;
  • report (directory) – This folder contains the skin of the Magento errors reports;
  • skin (directory) – There are located the themes files – images, JavaScript files, CSS files, Flash files. Also there can be found the skin files for the installation of skins and administration templates;
  • var (directory) – Cache, sessions, database backups, data exports and cached error reports can be found in this directory;

Join Magento tutorial for beginners for better knowledge about Magento.

We also contribute great content of Magento Tutorial for Magento 1.x.


magento tutorial

About Champ

Heap | Mobile and Web Analytics