26

Magento has three code pools:

  1. community
  2. core
  3. local

Core: It contains all Magento default modules

Community and local: We use these code pools for our custom module development.

Now I have doubt about this:

  • why does Magento use two code pools for our customization?
  • why doesn't Magento use one single code pool for customization?

Could someone explain about this?

34

app/code/core - Holds modules that are distributed with the base Magento and make up the core functionality.

app/code/community - Holds modules that are developed by third-parties

app/code/local - Holds custom modules you developed, including Mage code overrides.

Why does Magento use two code pool for our customization?

Magento actually uses three code pools. It will load local first, community second, and core third. It uses three for organization purposes and to help solve issues when two+ 3rd party extensions are trying to rewrite the same thing. In a example were you have two extensions in app/code/community trying to rewrite the same model, you can simply make a extension in app/code/local and merge the two extensions logic together.

Why doesn't Magento use single code pool for customization?

It was done this way to try to have some code organization. Also, when you have 3rd party conflicts, the local is great to help solve those issues. The local is also great to have extensions that only that site will ever have.

  • 1
    Nice answer on single code pool question. Given all the conflicts you will run across after installing several third party modules, it's very necessary to have that third local code pool to massage out all the hangups. – Fiasco Labs Dec 26 '13 at 7:01
11

enter image description here

core : This code pool belongs to the Magento core development team. So you should NOT make any modifications in this code pool.

community : This belongs to Magento community developers (including any developer who develop third party extensions). If you are creating any third party extensions, so you can use this code pool for that.

local : This can be used if you want to do any modifications (add new functionality / extension overriding / core functionality modifications etc.) specifically for your Magento store and do not want to share it with the community. At the same time you can override the functionality in core and community code pools

4

Describe Magento Codepools

Core pool

First of all, this folder stores all the code that makes Magento so powerful, flexible and lovely. The chief rule of Magento development is that you should never make any changes in it. In other words, this folder belongs to Magento core developers only and if you are going to edit anything in this pool, their evil spirit could punish you even through the display.

Community pool

This folder belongs entirely to community developers. This is the right place for hundreds of 3rd party extensions, both free and paid, that can be found at MagentoConnect or available on extensions development store. So basically, if you have installed any extension, it must be in app/code/community/ only.

Local pool

If you have your own Magento-based store and want to make everything by yourself or you are a Magento developer and have a purpose to change the logic somehow, local pool is the place where everything should be done. If you want to override Magento extensions, blocks or methods, copy the necessary folders from the Core pool and do whatever you are inclined to do. Apply the same rule for custom extensions that are created specifically for the website – all code should be in local pool.

4

Adding all the above in simple its for making priorities and having modularity. You can check the same in Mage.php.

Loading code pools with

 $paths[] = BP . DS . 'app' . DS . 'code' . DS . 'local';
 $paths[] = BP . DS . 'app' . DS . 'code' . DS . 'community';
 $paths[] = BP . DS . 'app' . DS . 'code' . DS . 'core';
 $paths[] = BP . DS . 'lib';

SO first Local called then community then core and magento will not find any core files then it will search on lib folder which contain the Zend-Framework Core files

1

The best explanation I have is that if you are aiming to distribute your extensions to a wider audience for example via Magento Connect you can place it into community.

This would allow another developer to override the behaviour by placing a class into the local folder.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.